Add external rollout as subrollout to Custom Attribute CA
Hey everybody!
I am working on a script based level design suite for an old idtech3 based game.
I have a large amount of repetitive GUI Elements that are common to many entities and I thought it'd be far more elegant if I could reference an external rollout in these classes instead of having to rewrite the same cod for each and every one of them.
But since I'm fairly new to Maxscript and I could not find a lot of information about this on the docs, My question is: how would I do that?
The Following Code snippet is one my Entity Class Definitions.
I would like to "outsource" then Spawnflag related Rollout Control elements along with the related functions to a "global rollout" that I can reference as a sub rollout.
--rootScene.MP_SpawnflagSets is a 2-Dimensional array that holds the label information for entity Spawnflags sorted into unique Sets. MPmisc_modelCA = attributes MPmisc_model ( -----start off MPmisc_modelCA parameters keys rollout:MPmisc_modelRO ( classname default:"misc_model" type:#string spawnflags default:"0" type:#string ui:SpawnflagVal model type:#string ui:et_model angles default:"0 0 0" type:#string modelscale_vec default:"0 0 0" type:#string origin default:"0 0 0" type:#string _rs type:#integer ui:spinner_rs default:1 _cs type:#integer ui:spinner_cs default:1 ) rollout MPmisc_modelRO "misc_model properties" ( checkbox 'spfl_1' "1" offset:[0,20] across:2 align:#left checkbox 'spfl_2' "2" offset:[0,20] across:2 align:#left checkbox 'spfl_3' "3" across:2 align:#left checkbox 'spfl_4' "4" across:2 align:#left checkbox 'spfl_5' "5" across:2 align:#left checkbox 'spfl_6' "6" across:2 align:#left checkbox 'spfl_7' "7" across:2 align:#left checkbox 'spfl_8' "8" across:2 align:#left checkbox 'spfl_9' "9" across:2 align:#left checkbox 'spfl_10' "10" across:2 align:#left edittext 'SpawnflagVal' "spawnflags" text:"0" enabled:true labelOnTop:false align:#left align:#left label 'SpawnflagLbl' "spawnflags 0" align:#left GroupBox 'grp1' "Spawnflags" pos:[4,7] width:154 height:160 align:#left fn UpdateFlagText spflset = ( TextArray = execute(rootScene.MP_SpawnflagSets[spflset]) chkbxarr=#() append chkbxarr spfl_1 append chkbxarr spfl_2 append chkbxarr spfl_3 append chkbxarr spfl_4 append chkbxarr spfl_5 append chkbxarr spfl_6 append chkbxarr spfl_7 append chkbxarr spfl_8 append chkbxarr spfl_9 append chkbxarr spfl_10 for i=1 to 10 do ( id = i as string obj = "spfl_" + id if i <= TextArray.count and TextArray[i] != undefined then ( chkbxarr[i].text = TextArray[i] ) else ( chkbxarr[i].text = "unused" chkbxarr[i].enabled = false ) ) ) fn updateSpawnflagValue = ( chkbxarr=#() append chkbxarr spfl_1 append chkbxarr spfl_2 append chkbxarr spfl_3 append chkbxarr spfl_4 append chkbxarr spfl_5 append chkbxarr spfl_6 append chkbxarr spfl_7 append chkbxarr spfl_8 append chkbxarr spfl_9 append chkbxarr spfl_10 j = 0 for i=1 to 10 do ( if chkbxarr[i].checked == true do j += 2^(i-1) ) spflval = j as string SpawnflagVal.text = spflval SpawnflagLbl.text = "spawnflags " + spflval ) fn FlagChecks = ( chkbxarr=#() append chkbxarr spfl_1 append chkbxarr spfl_2 append chkbxarr spfl_3 append chkbxarr spfl_4 append chkbxarr spfl_5 append chkbxarr spfl_6 append chkbxarr spfl_7 append chkbxarr spfl_8 append chkbxarr spfl_9 append chkbxarr spfl_10 checkVal = spawnflags as integer for c=10 to 1 by -1 do ( if (checkVal - 2^(c-1)) >= 0 do ( checkVal = checkVal - 2^(c-1) --format "new checkVal %\n" checkVal --format "checkbox % is checked\n" c chkbxarr[c].checked = true ) ) ) -----start of spawnFlag Checkbox Event Handlers on spfl_1 changed state do ( updateSpawnflagValue() ) on spfl_2 changed state do ( updateSpawnflagValue() ) on spfl_3 changed state do ( updateSpawnflagValue() ) on spfl_4 changed state do ( updateSpawnflagValue() ) on spfl_5 changed state do ( updateSpawnflagValue() ) on spfl_6 changed state do ( updateSpawnflagValue() ) on spfl_7 changed state do ( updateSpawnflagValue() ) on spfl_8 changed state do ( updateSpawnflagValue() ) on spfl_9 changed state do ( updateSpawnflagValue() ) on spfl_10 changed state do ( updateSpawnflagValue() ) ----end of spawnFlag Checkbox Event Handlers edittext 'et_model' "model" width:140 height:36 enabled:true labelOnTop:true align:#left button 'b_model' "Browse..." width:60 height:18 align:#left spinner 'spinner_rs' "recieve Shadows " align:#right fieldwidth:30 min:0 max:7 default:1 type:#integer spinner 'spinner_cs' "cast Shadows" align:#right fieldwidth:30 min:0 max:7 default:1 type:#integer on MPmisc_modelRO open do ( UpdateFlagText(17) SpawnflagVal.visible = false SpawnflagLbl.caption = "spawnflags "+SpawnflagVal.text --if _rs != 1 then spinner_rs.checked = true else chkbx_rs.checked = false --if _cs != 1 then chkbx_cs.checked = true else chkbx_cs.checked = false FlagChecks() ) on b_model pressed do ( ep = getOpenFileName caption:"Open A Model File:" rp = substituteString (subString ep ((findString ep "base")+5) -1) "\\" "/" et_model.text = rp ) on chkbx_rs changed state do ( if chkbx_rs.checked == true then _rs = 1 else _rs = 0 ) on chkbx_cs changed state do ( if chkbx_cs.checked == true then _cs = 1 else _cs = 0 ) ) ) ----end of MPmisc_modelCA
Could anyone here give me an example of how to implement something like this?