This Macro needs a UI

I made a macro of a repetitive task of attaching an object to a box. I would like to be able to choose the object to attach from a UI and then continue on with the rest of the macro.

Box lengthsegs:1 widthsegs:1 heightsegs:1 length:600 width:600 height:600 mapcoords:on transform:(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0]) isSelected:on
modPanel.addModToSelection (Edit_Poly ()) ui:on
$.modifiers[#Edit_Poly].SetOperation #Attach

:This is where I want to UI button to choose an object to selectand then continue with the rest of the macro once an object is selected.

$.modifiers[#Edit_Poly].Attach $hexwall4 editPolyNode:$
subobjectLevel = 5
$.modifiers[#Edit_Poly].SetSelection #Face #{}
$.modifiers[#Edit_Poly].Select #Face #{1..6}
actionMan.executeAction 0 "40020" -- Edit: Delete Objects
$.modifiers[#Edit_Poly].ButtonOp #DeleteFace

The Macro is to prep objects for export to UE
Any help is appreciated

Thanks
ME

Comments

Comment viewing options

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

.

Try this:

(
	global rol_AttachToBox
	try(destroyDialog rol_AttachToBox)catch()
	rollout rol_AttachToBox "Attach to Box"
	(
		local newBoxObj = undefined 
		button btn_crateBox "Create Box" width:140
		pickbutton pbtn_selectObj "Pick the Object" width:140
 
 
		on btn_crateBox pressed do
		(
			newBoxObj = Box lengthsegs:1 widthsegs:1 heightsegs:1 length:600 width:600 height:600 mapcoords:on transform:(matrix3 1) isSelected:on
			modPanel.addModToSelection (Edit_Poly ()) ui:on
		)
 
		on pbtn_selectObj picked obj do
		(
			if isValidNode newBoxObj do
			(
				if (iskindof obj geometryclass and canconvertto obj editable_mesh) do
				(
					newBoxObj.modifiers[#Edit_Poly].SetOperation #Attach
 
					newBoxObj.modifiers[#Edit_Poly].Attach obj editPolyNode:newBoxObj
					subobjectLevel = 5
					newBoxObj.modifiers[#Edit_Poly].SetSelection #Face #{}
					newBoxObj.modifiers[#Edit_Poly].Select #Face #{1..6}
					actionMan.executeAction 0 "40020" -- Edit: Delete Objects
					newBoxObj.modifiers[#Edit_Poly].ButtonOp #DeleteFace
				)
			)
		)
	)
	createdialog rol_AttachToBox 
)

Comment viewing options

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