Let say we have shapeboolean with some operand. if we change a node name, the operand list wouldn’t be updated and always shows the old name. Anyone have idea to solve this?
what is shapeboolean? wtat max vertion do we talk about?
I’m using 2021, but this is the documentation:
added in 2019:
… to get the index probably you can use GetReference for second param block. All operands are in reference order - object 1, transform 1, object 2, transform 2, …
most Boolean objects (Compaund) use the same interface
SetOperandName works just fine, But it’s difficult for me to get the operands (objects) list, would you please describe it more?
I couldn’t find operand nodes the other way. This of course won’t work if you remove operand or change the order of operands afterwards
shapebool = $ operands = for s in shapes collect ( if findItem (refs.dependentNodes s.baseobject) shapebool > 0 then s else dontCollect ) print operands deleteAllChangeHandlers id:#jah42 when name operands changes id:#jah42 val do ( format "%\n" val index = findItem operands val if index > 0 do shapebool.SetOperandName index val.Name )
or something like this
fn RenameShapeBooleanOperands = ( local names = callbacks.notificationParam() -- pseudocode if sb in getClassInstances ShapeBoolClass do ( foreach operand in sb where operand.Name == names do operand.Name = names ) ) callbacks.addScript #nodeRenamed "RenameShapeBooleanOperands()" id:#jah42 callbacks.addScript #nodeNameSet "RenameShapeBooleanOperands()" id:#jah42
ShapeBoolean uses a new interface for operand objects then ProBoolean or ProCut. All objects you can find in .objects now.
But they are stored as objects in the added state. So you usually see DerivedObjects in #objects
Technically, the operand node can be removed after you’ve created the ShapeBoolean (similar to how Morpher works). In this case, you cannot find the original node by dependency test.
But if the node of the operand still exists, you should be able to find it like:
a = refs.getreference <shapebool>.objects[n] b = (refs.dependentnodes a)