Maxscript: Get currently selected operand objects of a boolean3 object?

Does anyone know if it is possible to get the currently selected operand objects (From the list box) for a boolean3 object within Maxscript? I know that you can change the properties of operands based on their index. But I want to change the properties of operands selected in the Listbox by the user.

AttachmentSize
boolean.jpg102.23 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Swordslayer's picture

 

(
	local LB_GETSEL = 0x187
	local LB_GETCOUNT = 0x18B
	local iGlobal = (dotNetClass "Autodesk.Max.GlobalInterface").Instance
 
	fn getListBoxItemCount hWnd =
		windows.sendMessage hWnd LB_GETCOUNT 0 0
 
	fn isListBoxItemSelected hWnd index =
		windows.sendMessage hWnd LB_GETSEL index 0 > 0
 
	local obj = modPanel.getCurrentObject()
	if isKindOf obj Boolean3 do
	(
		local cpHWnd = iGlobal.UtilGetCoreInterface.CommandPanelRollup.HWnd
		local cpChildren = windows.getChildrenHWnd cpHWnd
		local listBoxHWnd = for child in cpChildren
			where UIAccessor.getWindowResourceID child[1] == 1020 do
				exit with child[1]
 
		if isKindOf listBoxHWnd Number do
		(
			local opName, itemCount = getListBoxItemCount listBoxHWnd
 
			local selectedItems = for i = 0 to itemCount - 1
				where isListBoxItemSelected listBoxHWnd i collect
					(obj.GetOperandName (i+1) &opName; opName)
		)
	)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.