Shape Boolean operands name update


#1

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?


#2

what is shapeboolean? wtat max vertion do we talk about?


#3

I’m using 2021, but this is the documentation:

https://help.autodesk.com/view/3DSMAX/2022/ENU/?guid=GUID-3D27C203-FB9C-4944-80F0-574B15573D98
https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-F8863F56-6FA3-43D7-8936-B06C5DCE776E
added in 2019:
https://help.autodesk.com/view/MAXDEV/2022/ENU/?guid=GUID-0890917F-5AC9-4E01-B860-0095172B48A9


#4

SetOperandName
… 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


#5

SetOperandName works just fine, But it’s difficult for me to get the operands (objects) list, would you please describe it more?


#6

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
)

upd
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[1] do operand.Name = names[2]	
	)

)

callbacks.addScript #nodeRenamed "RenameShapeBooleanOperands()" id:#jah42
callbacks.addScript #nodeNameSet "RenameShapeBooleanOperands()" id:#jah42

#7

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)[1]