Can I get bool value from the question "does node object info contain object right now?" somehow? (or collection info node)
4 Answers
With Blender V3.1+ you can use the Domain Size node in that way :
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 :
The output of pretty much any socket of the node will evaluate to True if there are at least 2 vertices in the mesh.
-
$\begingroup$ Is there a way to do this for a Material Group Input? $\endgroup$– MartyCommented Oct 20 at 0:33
🛑 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:
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:
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.