6
$\begingroup$

Can I get bool value from the question "does node object info contain object right now?" somehow? (or collection info node) enter image description here

$\endgroup$

4 Answers 4

8
$\begingroup$

With Blender V3.1+ you can use the Domain Size node in that way :

enter image description here

The output of the Math node can be used as a boolean since it will return 0 if there a no evaluated instances in the Object Info node. You don't even need the Math node since the instance count will evaluate to True for values > 0.

With Blender 3.0 I don't know of a very straightforward way. I'll assume the object contains some geometry with at least 2 vertices. You can use the Attribute Statistic node :

enter image description here

The output of pretty much any socket of the node will evaluate to True if there are at least 2 vertices in the mesh.

$\endgroup$
1
  • $\begingroup$ Is there a way to do this for a Material Group Input? $\endgroup$
    – Marty
    Commented Oct 20 at 0:33
3
$\begingroup$

🛑 Note: use Gorgious' solution, unless you really need Blender 3.0

In Blender 3.0 You can pass any non-zero value for a point, then use any of the 5 first outputs of the Attribute Statistic node:

This is only a slight improvement from Gorgious' answer, as it works for a single vertex as well. However, you could just use Scale and assume no object has scale = 0;0;0:

$\endgroup$
0
$\begingroup$

I wanted to check if the input field of my geometry node contained any object... Using the logic from the previous answers, I came up with something similar:

Using Boundig Box

If there is no object selected, then the size of the bounding box will equal zero. In my case, I'm using the result for a switch node. If the result is zero (there is no selected object in the input field) I'm adding a "purple mesh", so the user can see it in the viewport.

$\endgroup$
0
$\begingroup$

There is actually a more simple way to get boolean value, by using scale It works fine even with an empty input. You can also use absolute node from vector math to handle negative-scale-objects enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .