Message 1 of 2
Maxscript Button error

Not applicable
09-05-2013
02:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
fn createAttributesWindow = ( try ( destroyDialog createAttributesUI ) catch() local createAttributesUI = rollout createAttributesUI "Create User Attributes" ( button addAttr_btn "Add Attribute" height:30 width:406 pos:[12,8] edittext defName_text "Definition Name" text:"userAttrs" height:17 width:180 pos:[18,46] edittext defNiceName_text "Nice Name" text:"User Attributes" height:17 width:206 pos:[210,46] subRollout attrContainer "" height:300 pos:[14,70] button execute_btn "Execute" height:30 width:202 pos:[12,375] button cancel_btn "Cancel" height:30 width:202 pos:[218,375] spinner attrCount_spinInt "" type:#integer range:[1,999,1] visible:false fn createAttrRollout numAttrs = ( roll = rolloutCreator ("attr" + numAttrs + "_roll") ("Attribute " + numAttrs) roll.begin() roll.addControl #edittext #attrName_text "Name" paramStr:("pos:[8,8] width:140 height:17 text:\"NewAttr" + numAttrs + "\"") roll.addControl #edittext #attrNiceName_text "Nice Name" paramStr:"pos:[155,8] width:195 height:17 text:\"New Attribute\"" roll.addControl #button #deleteAttr_btn "" paramStr:"border:false height:25 width:25 pos:[355,6] images:#(\"enss_tools_24i.bmp\",undefined,13,3,3,4,4)" roll.addControl #label #drop_label "Type" paramStr:"pos:[8,36] width:30" roll.addControl #dropdownlist #attrType_drop "" paramStr:"pos:[38,36] width:70 items:#(\"String\",\"Float\",\"Integer\",\"Boolean\",\"Enum\")" roll.addControl #label #enum_label "Seperate Items By Comma" paramStr:"pos:[116,36] align:#left width:200 visible:false" roll.addControl #checkbox #locked_chkbox "Locked " paramStr:"width:60 pos:[260,36]" roll.addControl #checkbox #hidden_chkbox "Hidden " paramStr:"width:60 pos:[320,36]" roll.addControl #edittext #attrStringValue_text "Value " paramStr:"pos:[7,64] width:365 height:17 visible:true" roll.addControl #spinner #attrFloatValue_spinFloat "Value " paramStr:"range:[-999999,999999,1.0] type:#float pos:[26,64] width:80 visible:false" roll.addControl #spinner #attrIntValue_spinInt "Value " paramStr:"range:[-999999,999999,1] type:#integer pos:[26,64] width:80 visible:false" roll.addControl #spinner #attrFloatMin_spinFloat "Min " paramStr:"range:[-999999,999999,0] type:#float pos:[180,64] width:80 visible:false" roll.addControl #spinner #attrIntMin_spinInt "Min " paramStr:"range:[-999999,999999,0] type:#integer pos:[180,64] width:80 visible:false" roll.addControl #spinner #attrFloatMax_spinFloat "Max " paramStr:"range:[-999999,999999,100.0] type:#float pos:[290,64] width:80 visible:false" roll.addControl #spinner #attrIntMax_spinInt "Max " paramStr:"range:[-999999,999999,100] type:#integer pos:[290,64] width:80 visible:false" roll.addControl #checkbox #attrBoolValue_chkbox " False" paramStr:"pos:[38,64] visible:false" roll.addControl #edittext #attrEnumValue_text "Values" paramStr:"pos:[7,64] width:365 height:17 visible:false" roll.addHandler #attrType_drop #selected paramStr:"itemIndex " codeStr:"if itemIndex==1 do (attrStringValue_text.visible=true;attrFloatValue_spinFloat.visible=false;attrFloatMin_spinFloat.visible=false;attrFloatMax_spinFloat.visible=false;attrIntValue_spinInt.visible=false;attrIntMin_spinInt.visible=false;attrIntMax_spinInt.visible=false; attrBoolValue_chkbox.visible = false;enum_label.visible=false;attrEnumValue_text.visible=false)" roll.addHandler #attrBoolValue_chkbox #changed paramStr:"state " codeStr:"if state == true then ( attrBoolValue_chkbox.text = \" True\" ) else ( attrBoolValue_chkbox.text = \" False\" )" roll.addHandler #deleteAttr_btn #pressed codeStr:("removeSubRollout createAttributesUI.attrContainer attr" + numAttrs + "_roll") roll.end() ) fn init = ( createDialog createAttributesUI 430 420 newAttrRollout = createAttrRollout (attrCount_spinInt.value as String) addSubRollout attrContainer newAttrRollout attrCount_spinInt.value += 1 ) on addAttr_btn pressed do ( newAttrRollout = createAttrRollout (attrCount_spinInt.value as String) addSubRollout attrContainer newAttrRollout attrCount_spinInt.value += 1 ) on execute_btn pressed do ( print createAttributesUI.attrContainer.rollouts ) on cancel_btn pressed do ( destroyDialog createAttributesUI ) ) createAttributesUI.init() )
-- Error occurred in deleteAttr_btn.pressed()
-- Frame:
-- createAttributesUI: undefined
>> MAXScript Rollout Handler Exception:
-- Unknown property: "attrContainer" in undefined <<
I am using a Rollout Creator to create rollots and then add them to a subRollout in my main dialog. Each new rollout has a Delete button that should allow it to delete itself out of the subRollout. I swear I had this working yesterday, but it seems today that it doesn't want to work anymore and I am now getting the error at the end of that code above. It seems as though the button can't find the subRollout in the dialog even though I am using an explicit path ( createAttributesUI.attrContainer). I almost wonder if the Rollout Creator isn't creating the definition correctly? Or am I trying to access it from the wrong scope? Thanks
Matt