Beginner question Help!!!

macroScrip xxx
category:"xxx"
toolTip:"xxx"
(
rollout Export"xxx"width:300 height:450
(
label ShowTip "SelectModel :" pos:[20,25] width:70 height:20 align:#left
label selectModelName "" pos:[100,25] style_sunkenedge:true width:180 height:20 align:#left

fn SelectOb=
(
print"aaaaaaaaaaa"
)

on Export open do
(
Export.SelectOb()
callbacks.addScript #selectionSetchanged "Export.SelectOb()" id:#SelectOb
)
on Export close do
(
isOpen =false
callbacks.removeScripts id:#SelectOb
)

)
createDialog Export
)

AtFirst,it's can run,but next day , run again, show error --> " Unknown property: "SelectOb" in undefined "

I am Beginner for MaxScript. Please help me. Thanks

Comments

Comment viewing options

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

.

You must define the rollout as a global variable, so the callback to have access to it.

macroScrip xxx
category:"xxx"
toolTip:"xxx"
(
	global rol_Export
	try(destroyDialog rol_Export)catch()
	rollout rol_Export"xxx"width:300 height:450
	(
		label ShowTip "SelectModel :" pos:[20,25] width:70 height:20 align:#left
		label selectModelName "" pos:[100,25] style_sunkenedge:true width:180 height:20 align:#left
 
		fn SelectOb =
		(
			print"aaaaaaaaaaa"
		)
 
		on rol_Export open do
		(
			rol_Export.SelectOb()
			callbacks.addScript #selectionSetchanged "rol_Export.SelectOb()" id:#SelectOb
		)
		on rol_Export close do
		(
			isOpen =false
			callbacks.removeScripts id:#SelectOb
		)
 
	)
	createDialog rol_Export
)

Comment viewing options

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