Hi @ferdinand,
Thank you for the detailed answer once again. It cleared a lot of things for me.
From what I understood, I should use BIT_CONTROLBOJECT to detect if the object is 'Touched' by a generator object (in my sample case: child 'Cube' hidden by parent 'Array').
I tried doing so, but it looks like BIT_CONTROLOBJECT of 'Cube' is true regardless if it is attached to 'Array'.
Please see the screenshots below.
For this input:
I get the following console output:
---Cube---
OHIDE: false
EHIDE: false
HIDEEXCEPTVIEWSELECT: false
LOD_HIDE: false
SUBOBJECT_AM: false
CONTROLOBJECT: true
You can see that the BIT_CONTROLOBJECT is true when 'Cube' is not attached to anything.
my pseudo code:
// Loop through selection.
for (Int32 i = 0; i < selection->GetCount(); ++i)
{
auto obj = (BaseObject*)selection->GetIndex(i);
std::unordered_set<BaseObject*> objs;
objs.insert(obj);
// Collect child objects recursively.
CollectChildren(obj, objs);
for (auto o : objs)
{
DiagnosticOutput("---@---", o->GetName());
DiagnosticOutput("OHIDE: @", o->GetNBit(NBIT::OHIDE));
DiagnosticOutput("EHIDE: @", o->GetNBit(NBIT::EHIDE));
DiagnosticOutput("HIDEEXCEPTVIEWSELECT: @", o->GetNBit(NBIT::HIDEEXCEPTVIEWSELECT));
DiagnosticOutput("LOD_HIDE: @", o->GetNBit(NBIT::LOD_HIDE));
DiagnosticOutput("SUBOBJECT_AM: @", o->GetNBit(NBIT::SUBOBJECT_AM));
DiagnosticOutput("CONTROLOBJECT: @", o->GetBit(BIT_CONTROLOBJECT));
// If o is visible, then calculate extents.
}
}
I also recreated analogous scenario that you provided ('Array' as a parent and 'Cube' as a child) and got the same console output as you did.
@ferdinand said in Generator object's children visibility:
'Array':
node.GetNBit(c4d.NBIT_EHIDE) = 0
node.GetNBit(c4d.NBIT_HIDEEXCEPTVIEWSELECT) = 0
node.GetNBit(c4d.NBIT_LOD_HIDE) = 0
node.GetNBit(c4d.NBIT_SUBOBJECT_AM) = 0
node.GetBit(c4d.BIT_CONTROLOBJECT) = True
'Cube':
node.GetNBit(c4d.NBIT_EHIDE) = 0
node.GetNBit(c4d.NBIT_HIDEEXCEPTVIEWSELECT) = 0
node.GetNBit(c4d.NBIT_LOD_HIDE) = 0
node.GetNBit(c4d.NBIT_SUBOBJECT_AM) = 0
node.GetBit(c4d.BIT_CONTROLOBJECT) = True
You can see that BIT_CONTROLOBJECT is true when 'Cube' is attached to 'Array', so I cannot differentiate if the object is invisible due to generator object, because before attaching it to a generator object, BIT_CONTROLOBJECT was already true.
Please let me know, if I am misunderstanding the things that you wrote.