home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2002-02-13 | 113.4 KB | 2,654 lines
-- Custom Attributes MacroScript File -- -- Created: May 15 2000 -- Last Updated: Jan 4 2001 -- -- Author : Frank DeLise -- Version: 3ds max 4 -- -- -- Custom Attributes Macroscript file. --*********************************************************************************************** -- MODIFY THIS AT YOUR OWN RISK -- -- This Script Adds Custom Attributes to Objects, Modifier and Materials MacroScript Custom_Attributes ButtonText:"Add Custom Attribute" Category:"Customize User Interface" internalCategory:"Customize User Interface" Tooltip:"Add a Custom Attribute" SilentErrors:(CAT_Debug != True) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Localization Notes -- -- /* Localize On */ states an area where localization should begin -- /* Localize Off */ states an area where localization should end -- -- *** Localization Note *** states that the next line has special localization instructions for the next line. -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ( Global CAT_Defs, CAT_NewAttrib, CAT_ValidCharacters = #() Global CAT_PropRoll_Boolean, CAT_PropRoll_Float, CAT_PropRoll_Integer, CAT_PropRoll_Material, CAT_PropRoll_Array, CAT_PropRoll_Color, CAT_PropRoll_Node, CAT_TestRoll, CAT_DoneRoll, CAT_ParamRoll, CAT_Float, CAT_AddRollName, CAT_CreateRoll, CAT_NewRollName, CAT_SelChange, CAT_EnableUI, CAT_DisableUI Global Cat_CheckedText, Cat_UIText, CAT_ChangeRoll, CAT_DeleteUIRoll, CAT_DefData, CAT_IsDeleting, CAT_UI_Array, CAT_UIList, CAT_Debug, CAT_AttribName, CAT_GetDef, CAT_DefExist, CAT_SetDef, CAT_CurrentDef, CAT_MActive, CAT_NewMActive, Cat_Reset Global CAT_Rollouts, CAT_Source = #(), CAT_Rollouts_List, CAT_UIItems, CAT_ParamBlock, CAT_UIItem, CAT_CUSTAttrib, CAT_ParamBlock_Array, CAT_UIItems_Array, CUSTString Global CAT_Set_Roll_Float, CAT_Set_Roll_Integer, CAT_Set_Roll_Boolean, CAT_Set_Roll_Color, CAT_Set_Roll_Node, CAT_Set_Roll_Array, CAT_Set_Roll_TextureMap, CAT_ModIndex Global CAT_EvalUI, CAT_AddUI, CAT_EditUI, CAT_EditUIRoll, CAT_TextChecker, CAT_Edit_Set, CAT_AnyErrors, CAT_AnyErrors_Num = 1 Persistent Global CAT_UINum, CAT_dummy_place_holder if CAT_UINum == undefined do ( CAT_UINum = 1 ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout States -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Global CAT_UI_POS, CAT_UI_Size, CAT_UI_Prop_State Global CAT_Boolean_State, CAT_Array_State, CAT_Integer_State, CAT_Float_State, CAT_Node_State, CAT_Material_State, CAT_Color_State Global CAT_Updating_UI = false -- keep CAT_EvalUI from looping. Specifies that you are already updating. -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Deleting UI Items -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ Rollout CAT_DeleteUIRoll "Delete Attribute" SilentErrors:(CAT_Debug != True) ( Button CAT_DeleteUI_All "Delete All" Align:#Center Offset:[0,0] Height:20 Width:100 ListBox CAT_UIList "Attributes:" Button CAT_DeleteUI_OK "Delete Selected" Across:2 Align:#Left Button CAT_DeleteUI_Cancel "Close" Align:#Right /* Localize Off */ On CAT_DeleteUI_OK pressed do ( -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is where the delete selected button action takes place. -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Here the def data Arrays are cleared to start a fresh one -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_ParamBlock_Array = #() CAT_UIItems_Array = #() CAT_UI_Array = #() If Debug == True then Format "%\n" ("Current Def Data Information Defore Deletion = " + CAT_Source as string) -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Count the number of UI items found in the definition from the Cat_GetDef() funtion, Then build a UI Items list , Cat_UIItems_Array and CAT_Paramblock array -- When building the new array, it excludes the ui item that corrispondes to the listbox item that was selected for delection. -- CAT_UI_Array is a string array for the delete listbox. -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// For i in 1 to CAT_DefData[2].count do ( If CAT_UIList.selection != i then ( If CAT_DefData[2][i] != undefined then ( Append CAT_UIItems_Array CAT_DefData[2][i] Append CAT_ParamBlock_Array CAT_DefData[1][i] ) ) ) -- Debug If Debug == True then Format "%\n" ("New UI List " + CAT_UIItems_Array as string + "\n") -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- CAT_NewAttrib is the source for defdata, CAT_NewAttrib[1] is the paramblock array, CAT_NewAttrib[2] is the UI items associated with the paramblock. This is what is associated -- in the the defdata of the object. -- -- Once the item is deleted, A new CAT_NewAttrib is made and the array are stuffed into CAT_NewAttrib[1] and CAT_NewAttrib[2] -- The Current definition is then set back to the current definition, "CAT_CurrentDef.Defdata = CAT_NewAttrib" -- CAT_CurrentDef is the current custom attribute and is retrieved whenever CAT_GetDef() is called on the selected object. -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_Source[1] = CAT_ParamBlock_Array as array CAT_Source[2] = CAT_UIItems_Array as array undo "Delete CA" on ( -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This flag is set to tell tha Cat_AddUI funtion that we are currently deleting -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_IsDeleting = True -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- CAT_AddUI is the function that adds the actually custom attribute -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If Debug == True then Format "%\n" ("Current Def Data Information after Deletion = " + CAT_Source as string) CAT_AddUI () Cat_SetDef() -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Update Delete List Box -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_UIList.items = CAT_UI_Array ) ) On CAT_DeleteUI_Cancel pressed Do ( DestroyDialog CAT_DeleteUIRoll ) On CAT_DeleteUI_All pressed do ( -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Delete the Custom Attribute Definition -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ if Querybox "This Will Delete ALL Custom Attributes \n On The Selected Object \n Continue?" Title:"Custom Attributes" then ( /* Localize Off */ Case CAT_DoneRoll.CAT_AddTo.selection of ( 1:(if getCommandPanelTaskMode() != #Create Then Max Create Mode; Undo "Delete All CAs" On (CustAttributes.Delete Selection[1].BaseObject CAT_CurrentDef)) 2:(Undo "Delete All CAs" On (CustAttributes.Delete Selection[1].modifiers[CAT_ModIndex] CAT_CurrentDef)) 3:(if getCommandPanelTaskMode() != #Create Then Max Create Mode; Undo "Delete All CAs" On (CustAttributes.Delete Selection[1].material CAT_CurrentDef)) ) if getCommandPanelTaskMode() != #Modify Then Max Modify Mode DestroyDialog CAT_DeleteUIRoll ) ) ) --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Boolen Options --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ Rollout CAT_PropRoll_Boolean "Boolean UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Size" ( Spinner CAT_Width "Width:" Width:70 Align:#Right Type:#Integer Range:[1,160,70] Across:2 Spinner CAT_Height "Height:" Width:70 Align:#Right Type:#Integer Range:[1,160,25] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) Group "Check Button Options" ( ColorPicker CAT_HighLight "Highlight Color:" Color:[253,221,8] Enabled:False ) /* Localize Off */ On CAT_Width Changed Value do Cat_EvalUI() On CAT_Height Changed Value do Cat_EvalUI() On CAT_Align Changed State do Cat_EvalUI() On CAT_Highlight Changed Color do Cat_EvalUI() ) --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Array Options --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ Rollout CAT_PropRoll_Array "Array UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Local CAT_MyArray = #() Group "Size" ( Spinner CAT_Width "Width:" Width:70 Align:#Right Type:#Integer Range:[1,160,150] Across:2 Spinner CAT_Height "Height:" Width:70 Align:#Right Type:#Integer Range:[1,160,5] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) Group "Array" ( EditText CAT_ArrayName "Item name:" Button CAT_AddItem "Add Item:" Across:2 Width:70 Button CAT_ClearArray "Clear Array:" Width:70 ListBox CAT_AItems "" ) /* Localize Off */ On CAT_AddItem pressed do ( checked_item_text = CAT_ArrayName.Text str = "\"" location = findString checked_item_text str master_location = 0 while location != undefined do ( master_location += location checked_item_text = replace checked_item_text master_location 1 "\\\"" location = findString (subString checked_item_text (master_location + 2) -1) str master_location += 1 ) Append CAT_MyArray checked_item_text formatted_name_array = #() for i in 1 to CAT_MyArray.count do ( temp_text_string = CAT_MyArray[i] -- strip the backslashes from the "'s before displaying in the list location = findString temp_text_string "\\\"" while location != undefined do ( temp_text_string = replace temp_text_string location 2 "\"" format temp_text_string location = findString temp_text_string "\\\"" ) Append formatted_name_array temp_text_string ) CAT_AItems.items = formatted_name_array Try(Cat_EvalUI())Catch() ) On CAT_ClearArray Pressed do ( CAT_MyArray = #() CAT_AItems.items = CAT_MyArray (Try(Cat_EvalUI())Catch()) ) On CAT_Width Changed value do Cat_EvalUI() On CAT_Height Changed value do Cat_EvalUI() On CAT_Align Changed State do Cat_EvalUI() ) --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Color Options --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ Rollout CAT_PropRoll_Color "Color UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Size" ( Spinner CAT_Width "Width:" Width:70 Align:#Right Type:#Integer Range:[1,160,100] Across:2 Spinner CAT_Height "Height:" Width:70 Align:#Right Type:#Integer Range:[1,160,25] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) Group "ColorPicker Default Color" ( ColorPicker CAT_DColor "Default Color:" Color:[253,221,8] Enabled:True ) /* Localize Off */ On CAT_Width Changed Value do Cat_EvalUI() On CAT_Height Changed Value do Cat_EvalUI() On CAT_Align Changed State do Cat_EvalUI() On CAT_DColor Changed Color do Cat_EvalUI() ) ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Node Options ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is the rollup for editing Node picking options /* Localize On */ Rollout CAT_PropRoll_Node "Node UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Size" ( Spinner CAT_Width "Width:" Width:70 Align:#Right Type:#Integer Range:[1,160,150] Across:2 Spinner CAT_Height "Height:" Width:70 Align:#Right Type:#Integer Range:[1,160,25] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) /* Localize Off */ On CAT_Width Changed Value do Cat_EvalUI() On CAT_Height Changed Value do Cat_EvalUI() On CAT_Align Changed State do Cat_EvalUI() ) ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Material Options ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is the rollup for editing Map Button options /* Localize On */ Rollout CAT_PropRoll_Material "TextureMap UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Size" ( Spinner CAT_Width "Width:" Width:70 Align:#Right Type:#Integer Range:[1,160,150] Across:2 Spinner CAT_Height "Height:" Width:70 Align:#Right Type:#Integer Range:[1,160,25] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) /* Localize Off */ On CAT_Width Changed Value do Cat_EvalUI() On CAT_Height Changed Value do Cat_EvalUI() On CAT_Align Changed State do Cat_EvalUI() ) --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Array Options --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is the rollup for editing Array options /* Localize On */ Rollout ArrayRoll "Attribute UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Array" ( EditText CAT_ArrayName "Item name:" Button CAT_AI "Add Item:" Across:2 Button CAT_DI "Delete Item:" ListBox CAT_AItems "" ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) /* Localize Off */ On CAT_Width Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Height Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Align Changed State do (Try(Cat_EvalUI())Catch()) ) --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Testing --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This rollup tests the attribute /* Localize On */ Rollout CAT_TestRoll "Testing Attribute" SilentErrors:(CAT_Debug != True) ( ) /* Localize Off */ ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Creating the final Attribute --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ Rollout CAT_DoneRoll "Finish" SilentErrors:(CAT_Debug != True) ( Group "Add Attribute to Type:" ( -- DropDownList CAT_AddTo Items:#("Object's Base Level ", "Object's Current Modifier", "Object's Material") Enabled:(Selection.count == 1) DropDownList CAT_AddTo Items:#("Object's Base Level ", "Object's Current Modifier") Enabled:(Selection.count == 1) ) Group "Add\Delete Custom Attribute" ( Button CAT_Add "Add" Width:50 Across:2 Height:20 Offset:[-5,0] Enabled:(Selection.count == 1) Button CAT_Delete "Delete" Width:50 Height:20 Enabled:(Selection.count == 1) -- Button CAT_Update "Update" Width:50 Height:20 Enabled:(Selection.count == 1) Label CAT_L2 "" Offset:[0,-10] ) /* Localize Off */ ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is where the whole thing begins. :) When "Add" in the UI is pressed the code starts here.... --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// On CAT_Add Pressed do ( Try(if CAT_EditUIRoll != undefined do DestroyDialog CAT_EditUIRoll)Catch() ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- set delete mode false --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_IsDeleting = False ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Clear UI and ParamBlock Arrays ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_ParamBlock_Array = #() CAT_UIItems_Array = #() CAT_Source = #() CAT_NewAttrib = #() ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- If Attribute exisits, extract definition ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_GetDef() ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Check for duplicate UI items ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Cat_ParamExists = False For i in 1 to Cat_Paramblock_Array.count do ( If Cat_Paramblock_Array[i].name == Cat_CheckedText then (Cat_ParamExists = True) ) /* Localize On */ If Cat_ParamExists == True then MessageBox "Parameter Name Exists!\nPlease Enter a New Name" Title:"Custom Attributes" /* Localize Off */ Else ( ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// --- Call the CAT_AddUI function, This funtion sets up the parameter and creates the custom attribute definition ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// undo "Add CA" on ( ui_added = CAT_AddUI () ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Once the UI item is added, it append the new UI item and Paramblock item into the following 2 arrays ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ui_added == true do ( Append CAT_ParamBlock_Array CAT_NewAttrib[1] Append CAT_UIItems_Array CAT_NewAttrib[2] If Debug == True then Format "%\n" ("Added ParamBlock Item:" + CAT_ParamBlock_Array[CAT_ParamBlock_Array.count].name as string) If Debug == True then Format "%\n" ("Added UI Item:" + CAT_ParamBlock_Array[CAT_ParamBlock_Array.count].name as string) -- Debug Print If CAT_Debug == True then Format "%\n" ("New ParamBlock Array: " + CAT_ParamBlock_Array as string + "\n") If CAT_Debug == True then Format "%\n" ("New UIItems Array: " + CAT_UIItems_Array as string + "\n") CAT_Source[1] = CAT_ParamBlock_Array CAT_Source[2] = CAT_UIItems_Array ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This takes the new paramblock and UI Items and sets it into the object as the new defdata using CAT_SetDef() function ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_SetDef () ---///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Increment the param name number and reset the UI name feilds --///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_UINum += 1 CAT_ParamRoll.CAT_UIName.text = ("Param" + CAT_UINum as string) Cat_CheckedText = ("Param" + CAT_UINum as string) Cat_UIText = Cat_CheckedText ) /* Localize On */ /* Localize Off */ ) -- undo off Try(Cat_EvalUI())Catch() -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Update Delete UI List -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Try ( CAT_GetDef() CAT_DeleteUIRoll.CAT_UIList.items = CAT_UI_Array )Catch() ) ) On CAT_Delete Pressed do ( CAT_GetDef() (CreateDialog CAT_DeleteUIRoll Pos:([CAT_Float.Pos.x + 225, CAT_Float.Pos.y + 250]) Width:200 Height:220) CAT_DeleteUIRoll.CAT_UIList.Items = CAT_UI_Array ) On CAT_Update Pressed do ( CAT_GetDef() CAT_EditUI() ) On CAT_DoneRoll open do ( Cat_EvalUI() if Cat_UIText != undefined do CAT_ParamRoll.CAT_UIName.text = Cat_UIText ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Float Options -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- UI options for floats /* Localize On */ Rollout CAT_PropRoll_Float "Float UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Size" ( Spinner CAT_Width "Width:" Width:100 Align:#Center Type:#Float Range:[1,160,160] ) Group "Range" ( Spinner CAT_UIRangeStart "From:" Range:[-99999,99999,0] Align:#Center Across:2 Type:#Float Width:90 Spinner CAT_UIRangeEnd "To:" Range:[-99999,99999,100] Align:#Right Type:#Float Width:90 Spinner CAT_UIRangeDefault "Default:" Range:[-99999,99999,0] Align:#Center Across:1 Type:#Float Width:95 Offset:[-5,0] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) Group "Orientation and Ticks" ( CheckBox CAT_Orient "Vertical:" Align:#Left Across:2 Enabled:False Spinner CAT_Ticks "Ticks:" Type:#Integer Range:[0,999,0] Enabled:False ) /* Localize Off */ On CAT_Ticks Changed value do (Try(Cat_EvalUI())Catch()) On CAT_UIRangeStart Changed value do (Try(Cat_EvalUI())Catch()) On CAT_UIRangeEnd Changed value do (Try(Cat_EvalUI())Catch()) On CAT_UIRangeDefault Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Width Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Height Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Align Changed State do (Try(Cat_EvalUI())Catch()) On CAT_Orient Changed State do (Try(Cat_EvalUI())Catch()) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for Integer Options -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- UI options for Integers and floats /* Localize On */ Rollout CAT_PropRoll_Integer "Integer UI Options" Rolledup:True SilentErrors:(CAT_Debug != True) ( Group "Size" ( Spinner CAT_Width "Width:" Width:100 Align:#Center Type:#Integer Range:[1,160,160] ) Group "Range" ( Spinner CAT_UIRangeStart "From:" Range:[-99999,99999,0] Align:#Center Across:2 Type:#Integer Width:90 Spinner CAT_UIRangeEnd "To:" Range:[-99999,99999,100] Align:#Right Type:#Integer Width:90 Spinner CAT_UIRangeDefault "Default:" Range:[-99999,99999,0] Align:#Center Across:1 Type:#Integer Width:90 Offset:[-5,0] ) Group "Alignment" ( RadioButtons CAT_Align Labels:#("Left", "Right", "Center") columns:3 Across:1 Default:3 ) Group "Orientation and Ticks" ( CheckBox CAT_Orient "Vertical:" Align:#Left Across:2 Enabled:False Spinner CAT_Ticks "Ticks:" Type:#Integer Range:[0,999,0] Enabled:False ) /* Localize Off */ On CAT_Ticks Changed value do (Try(Cat_EvalUI())Catch()) On CAT_UIRangeStart Changed value do (Try(Cat_EvalUI())Catch()) On CAT_UIRangeEnd Changed value do (Try(Cat_EvalUI())Catch()) On CAT_UIRangeDefault Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Width Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Height Changed value do (Try(Cat_EvalUI())Catch()) On CAT_Align Changed State do (Try(Cat_EvalUI())Catch()) On CAT_Orient Changed State do (Try(Cat_EvalUI())Catch()) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Rollout for UI Type Options -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize On */ Rollout CAT_ParamRoll "Attribute Style" SilentErrors:(CAT_Debug != True) ( Local CAT_Items = #("Float", "Integer", "Boolean", "Array", "Node", "Color", "TextureMap") --, CAT_AddUI Group "Parameter Type:" ( DropDownList CAT_Type Items:CAT_Items ) Group "UI Type" ( DropDownList CAT_UIType Items:#("Spinner", "Slider") EditText CAT_UIName "Name:" text:"Param" -- + CAT_UINum as string) ) /* Localize Off */ On CAT_UIType selected i do ( Cat_EvalUI() ) On CAT_UIName Changed text do ( -- AF (4/23/01) make this a valid sting by putting single quotes around it CAT_TextChecker text ) On CAT_UIName entered text do ( -- AF (4/23/01) make this a valid sting by putting single quotes around it CAT_TextChecker text Cat_EvalUI() ) On CAT_ParamRoll Close do ( Try( CallBacks.RemoveScripts #SelectionSetChanged ID:#CAT_Callback if CAT_DeleteUIRoll != undefined do DestroyDialog CAT_DeleteUIRoll if CAT_EditUIRoll != undefined do DestroyDialog CAT_EditUIRoll if CAT_CreateRoll != undefined do DestroyDialog CAT_CreateRoll )Catch() ) On CAT_ParamRoll moved pos do ( CAT_UI_POS = POS ) On CAT_ParamRoll Resized Size do ( CAT_UI_Size = Size ) On CAT_Type selected i do ( Case of ( -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Float -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 1):(CAT_Set_Roll_Float()) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Integer -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 2):(CAT_Set_Roll_Integer()) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Boolean --- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 3):(CAT_Set_Roll_Boolean()) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Array -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 4):(CAT_Set_Roll_Array ()) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Node -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 5):(CAT_Set_Roll_Node()) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Color -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 6):(CAT_Set_Roll_Color()) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- TextureMap -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// (i == 7):(CAT_Set_Roll_TextureMap()) ) ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Function for testing the UI -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FN Cat_EvalUI = ( -- Try( if CAT_Updating_UI == false do ( CAT_Updating_UI = true RemoveRollout CAT_TestRoll CAT_Float -- *** Localization Note *** -- The "Testing Attribute" name needs to be localized in ("Rollout CAT_TestRoll \"Testing Attribute\" \n" + ) Cat_EvalString = "Rollout CAT_TestRoll \"Testing Attribute\" \n" + "( \n" Case CAT_ParamRoll.CAT_UIType.selected of ( -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Spinner -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "Spinner":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += CAT_ParamRoll.CAT_UIType.selected + " Cat_Testui " + "\"" + Cat_UIText + "\"" + " Type:#" Case CAT_ParamRoll.CAT_Type.Selection of ( 1:( Cat_EvalString += "Float" Cat_EvalString += " Width:" + CAT_PropRoll_Float.CAT_Width.value as string -- Cat_EvalString += " Height:" + CAT_PropRoll_Float.CAT_Height.value as string Cat_EvalString += " Range:[" + CAT_PropRoll_Float.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeDefault.value as string + "]" Cat_EvalString += " Align:#" Case CAT_PropRoll_Float.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) CAT_PropRoll_Float.CAT_Orient.Enabled = False CAT_PropRoll_Float.CAT_Ticks.Enabled = False CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) ) 2:( Cat_EvalString +="Integer" Cat_EvalString += " Width:" + CAT_PropRoll_Integer.CAT_Width.value as string -- Cat_EvalString += " Height:" + CAT_PropRoll_Integer.CAT_Height.value as string Cat_EvalString += " Range:[" + CAT_PropRoll_Integer.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string + "]" Cat_EvalString += " Align:#" Case CAT_PropRoll_Integer.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) CAT_PropRoll_Integer.CAT_Orient.Enabled = False CAT_PropRoll_Integer.CAT_Ticks.Enabled = False CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) ) ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Slider -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "Slider":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += (CAT_ParamRoll.CAT_UIType.selected + " CAT_Testui " + "\"" + Cat_UIText + "\"" + " Type:#") Case CAT_ParamRoll.CAT_Type.selection of ( 1:( Cat_EvalString += "Float" Cat_EvalString += " Width:" + CAT_PropRoll_Float.CAT_Width.value as string -- Cat_EvalString += " Height:" + CAT_PropRoll_Float.CAT_Height.value as string Cat_EvalString += " Align:#" Case CAT_PropRoll_Float.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) Cat_EvalString += " Orient:#" + (if CAT_PropRoll_Float.CAT_Orient.state == True then "Vertical" Else "Horizontal") Cat_EvalString += " Ticks:" + CAT_PropRoll_Float.CAT_Ticks.value as string Cat_EvalString += " Range:[" + CAT_PropRoll_Float.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeDefault.value as string + "]" CAT_PropRoll_Float.CAT_Orient.Enabled = True CAT_PropRoll_Float.CAT_Ticks.Enabled = True ) 2:( Cat_EvalString += "Integer" Cat_EvalString += " Width:" + CAT_PropRoll_Integer.CAT_Width.value as string -- Cat_EvalString += " Height:" + CAT_PropRoll_Integer.CAT_Height.value as string Cat_EvalString += " Align:#" Case CAT_PropRoll_Integer.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) Cat_EvalString += " Orient:#" + (if CAT_PropRoll_Integer.CAT_Orient.state == True then "Vertical" Else "Horizontal") Cat_EvalString += " Ticks:" + CAT_PropRoll_Integer.CAT_Ticks.value as string Cat_EvalString += " Range:[" + CAT_PropRoll_Integer.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string + "]" CAT_PropRoll_Integer.CAT_Orient.Enabled = True CAT_PropRoll_Integer.CAT_Ticks.Enabled = True ) ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- DropDownList -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "DropDownList":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += ("DropDownList" + " CAT_Testui " + "\"" + Cat_UIText + "\" ") Cat_EvalString += (" Width:" + CAT_PropRoll_Array.CAT_Width.value as string) Cat_EvalString += (" Height:" + CAT_PropRoll_Array.CAT_Height.value as string) Cat_EvalString += (" Align:#") Case CAT_PropRoll_Array.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) Cat_EvalString += (" Items:" + CAT_PropRoll_Array.CAT_MyArray as string) CAT_PropRoll_Float.CAT_Orient.Enabled = False CAT_PropRoll_Float.CAT_Ticks.Enabled = False ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Checkbox -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "CheckBox": ( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += (CAT_ParamRoll.CAT_UIType.selected + " CAT_Testui " + "\"" + Cat_UIText + "\"" + " Type:#Boolean") Cat_EvalString += (" Width:" + CAT_PropRoll_Boolean.CAT_Width.value as string) Cat_EvalString += (" Height:" + CAT_PropRoll_Boolean.CAT_Height.value as string) Cat_EvalString += (" Align:#") Case CAT_PropRoll_Boolean.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) CAT_PropRoll_Boolean.CAT_Highlight.Enabled = False ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- CheckButton -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "CheckButton":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += (CAT_ParamRoll.CAT_UIType.selected + " CAT_Testui " + "\"" + Cat_UIText + "\"" + " Type:#Boolean") Cat_EvalString += (" Width:" + CAT_PropRoll_Boolean.CAT_Width.value as string) Cat_EvalString += (" Height:" + CAT_PropRoll_Boolean.CAT_Height.value as string) Cat_EvalString += (" HighlightColor:" + CAT_PropRoll_Boolean.CAT_Highlight.color as string) Cat_EvalString += " Align:#" Case CAT_PropRoll_Boolean.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) CAT_PropRoll_Boolean.CAT_Highlight.Enabled = True ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- MapButton -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "MapButton":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += (CAT_ParamRoll.CAT_UIType.selected + " CAT_Testui " + "\"" + Cat_UIText + "\"" + " Type:#Material") Cat_EvalString += (" Width:" + CAT_PropRoll_Material.CAT_Width.value as string) Cat_EvalString += (" Height:" + CAT_PropRoll_Material.CAT_Height.value as string) Cat_EvalString += " Align:#" Case CAT_PropRoll_Material.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- ColorPicker -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "ColorPicker":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += (CAT_ParamRoll.CAT_UIType.selected + " CAT_Testui " + "\"" + Cat_UIText + "\"" + " Type:#Color") Cat_EvalString += (" Width:" + CAT_PropRoll_Color.CAT_Width.value as string) Cat_EvalString += (" Height:" + CAT_PropRoll_Color.CAT_Height.value as string) Cat_EvalString += (" Color:" + CAT_PropRoll_Color.CAT_DColor.Color as string) Cat_EvalString += " Align:#" Case CAT_PropRoll_Color.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- PickButton -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// "PickButton":( CAT_DoneRoll.CAT_Add.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_Delete.enabled = (Selection.count ==1) CAT_DoneRoll.CAT_AddTo.enabled = (Selection.count ==1) Cat_EvalString += (CAT_ParamRoll.CAT_UIType.selected + " CAT_Testui " + "\"" + Cat_UIText + "\"" + " Type:#Node") Cat_EvalString += (" Width:" + CAT_PropRoll_Node.CAT_Width.value as string) Cat_EvalString += (" Height:" + CAT_PropRoll_Node.CAT_Height.value as string) Cat_EvalString += " Align:#" Case CAT_PropRoll_Node.CAT_Align.state of ( 1:(Cat_EvalString += "Left") 2:(Cat_EvalString += "Right") 3:(Cat_EvalString += "Center") ) ) ) Cat_EvalString += "\n) \n" + "AddRollout CAT_TestRoll CAT_Float \n" Try(Execute Cat_EvalString)Catch( CAT_Updating_UI = false ) CAT_Updating_UI = false --)Catch() ) ) FN CAT_AddUI = ( If Debug == True then Format "%\n" ("------------------------------------------------------------- \n -- Add UI Performed.. \n-------------------------------------------------------------") -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Setup String Streams -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Local CUSTString = StringStream, CAT_UIParamString = StringStream, CAT_MainParamString = StringStream, CAT_RolloutString = StringStream, CAT_UIString = StringStream, CAT_UIEndString = StringStream, CAT_ArrayString = Stringstream -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Define Attribute Definition Start -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- *** Localization Note *** -- The "Custom_Attributes" name needs to be localized in CAT_MainParamString = ("CAT_DEF = attributes Custom_Attributes \n") CAT_MainParamString = ("CAT_DEF = attributes Custom_Attributes \n") If CAT_DefExist () == True then CAT_MainParamString += "Redefine:CAT_CurrentDef\n" CAT_MainParamString += ("(\n") CAT_MainParamString += ("Parameters main rollout:params\n") CAT_MainParamString += "(\n" -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build First ParamBlock Def -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- AF (4/23/01) All we need to do is put "'"'s around the string Cat_TextChecker CAT_ParamRoll.CAT_UIName.text -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- If in Delete Mode then skip the following -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_IsDeleting == false then ( CAT_NewAttrib[1] = CAT_ParamBlock Name:(Cat_CheckedText as string) -- CAT_NewAttrib[1].ui = (Cat_UIText as string) CAT_NewAttrib[1].ui = (Cat_CheckedText as string) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Is the ParamBlock an Array? -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if CAT_ParamRoll.CAT_Type.Selected != "Array" then ( CAT_NewAttrib[1].Type = CAT_ParamRoll.CAT_Type.Selected ) Else ( CAT_NewAttrib[1].Type = "Integer" CAT_NewAttrib[1].Default = "1" ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Is the ParamBlock an Integer Float, Boolean or Color? -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if CAT_ParamRoll.CAT_Type.Selected == "Integer" then ( CAT_NewAttrib[1].Default = CAT_PropRoll_Float.CAT_UIRangeDefault.value as string ) Else if CAT_ParamRoll.CAT_Type.Selected == "Boolean" then ( CAT_NewAttrib[1].Default = "False" ) Else if CAT_ParamRoll.CAT_Type.Selected == "Float" then ( CAT_NewAttrib[1].Default = CAT_PropRoll_Float.CAT_UIRangeDefault.value as string ) Else if CAT_ParamRoll.CAT_Type.Selected == "Color" then ( CAT_NewAttrib[1].Default = CAT_PropRoll_Color.CAT_DColor.color as string ) Else(CAT_NewAttrib[1].Default = "1") ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Begin CUSTString, This will be the String that is Executed -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CUSTString = CAT_MainParamString -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build Exisiting Param Block String -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_ParamBlock_Array.count >= 1 then ( For i in 1 to CAT_ParamBlock_Array.count do ( If Debug == True then Format "%\n" ("ReBuilding ParamBlock Item:" + CAT_ParamBlock_Array[i].name as string) CurrentParam = CAT_ParamBlock_Array[i] CAT_UIParamString = CurrentParam.Name + " Type:#" + CurrentParam.Type + " UI:" + CurrentParam.UI If CurrentParam.Type == "Node" then (CAT_UIParamString += "\n") Else If CurrentParam.Type == "TextureMap" then (CAT_UIParamString += "\n") Else (CAT_UIParamString += " Default:" + CurrentParam.Default + "\n") CUSTString += CAT_UIParamString ) ) -- Debug If Debug == True then Format "%\n" ("Delete Mode:" + CAT_IsDeleting as string + "\n") -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Add new Parameter -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_IsDeleting == False then ( CAT_UIParamString = CAT_NewAttrib[1].Name + " Type:#" + CAT_NewAttrib[1].Type + " UI:" + CAT_NewAttrib[1].UI If CAT_ParamRoll.CAT_Type.Selected == "Node" then (CAT_UIParamString += "\n") Else if CAT_ParamRoll.CAT_Type.Selected == "TextureMap" then (CAT_UIParamString += "\n") Else (CAT_UIParamString += " Default:" + CAT_NewAttrib[1].Default + "\n") CUSTString += CAT_UIParamString ) -- Debug If Cat_Debug == True then Format "%\n" CUSTString -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build Rollout String -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_RolloutString = ")\n" -- *** Localization Note *** -- The "Custom Attributes" name needs to be localized in ("Rollout Params \"" + "Custom Attributes" + "\"\n") CAT_RolloutString += ("Rollout Params \"" + "Custom Attributes" + "\"\n") CAT_RolloutString += "(\n" CUSTString += CAT_RolloutString -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build Array String -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_ArrayString = "\n" -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build Existing Array -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_UIItems_Array.count >= 1 then ( For i in 1 to CAT_UIItems_Array.count do ( If CAT_UIItems_Array[i].ui == "DropdownList" then ( CAT_ArrayString += ("Local '" + (substring CAT_UIItems_Array[i].name 2 (CAT_UIItems_Array[i].name.count-2)) + "Array' = " + CAT_UIItems_Array[i].array as string + "\n") ) ) CAT_ArrayString += "\n" CUSTString += CAT_ArrayString ) If CAT_Debug == True then Format "%\n" ("Array Output:" + CAT_ArrayString) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- If an Array is used, build an Array definition -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_IsDeleting == False then ( if CAT_ParamRoll.CAT_Type.Selected == "Array" then ( CAT_ArrayString = ("Local '" + (substring Cat_CheckedText 2 (Cat_CheckedText.count-2)) + "Array' = #(") For i in 1 to CAT_PropRoll_Array.CAT_MyArray.count do ( CAT_ArrayString += "\"" CAT_ArrayString += (CAT_PropRoll_Array.CAT_MyArray[i] as string) CAT_ArrayString += "\"" If i != CAT_PropRoll_Array.CAT_MyArray.count then CAT_ArrayString += ", " ) CAT_ArrayString += ")\n" CUSTString += CAT_ArrayString ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Start UI String -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_UIString = "\n" -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build Exisiting UI array -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_UIItems_Array.count >= 1 then ( CAT_ArrayUIString = StringStream For i in 1 to CAT_UIItems_Array.count do ( If Debug == True then Format "%\n" ("ReBuilding UI item:" + CAT_UIItems_Array[i].name as string) CurrentUI = CAT_UIItems_Array[i] CAT_ArrayUIString = (CurrentUI.UI + " " + CurrentUI.Name + " \"" + CurrentUI.String + "\" Width:" + CurrentUI.Width + " Height:" + CurrentUI.Height + " Align:#" + CurrentUI.Align + " Type:#" + CurrentUI.Type) CAT_ArrayUIString += (" Range:" + CurrentUI.Range + " Orient:#" + CurrentUI.Orient + " Ticks:" + CurrentUI.Ticks + " Items:" + CurrentUI.Items + " HighLightcolor:" + CurrentUI.HighLightColor) CAT_ArrayUIString += (" Color:" + CurrentUI.Color + "\n") CUSTString += CAT_ArrayUIString ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build new UI parametar -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_IsDeleting == False then ( Case CAT_ParamRoll.CAT_UIType.selected of ( "Spinner":( CAT_NewAttrib[2] = CAT_UIItem UI:"Spinner" Name:(Cat_CheckedText as string) String:Cat_UIText Case CAT_ParamRoll.CAT_Type.Selection of ( 1:( CAT_NewAttrib[2].Type = "Float" CAT_NewAttrib[2].Width = CAT_PropRoll_Float.CAT_Width.value as string;CAT_NewAttrib[2].Width = CAT_PropRoll_Float.CAT_Width.value as string -- CAT_NewAttrib[2].Height = CAT_PropRoll_Float.CAT_Height.value as string;CAT_NewAttrib[2].Height = CAT_PropRoll_Float.CAT_Height.value as string CAT_NewAttrib[2].Range = ("[" + CAT_PropRoll_Float.CAT_UIRangeStart.value as string + ", " + CAT_PropRoll_Float.CAT_UIRangeEnd.value as string + ", " + CAT_PropRoll_Float.CAT_UIRangeDefault.value as string + "]") Case CAT_PropRoll_Float.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) ) 2:( CAT_NewAttrib[2].Type = "Integer" CAT_NewAttrib[2].Width = CAT_PropRoll_Integer.CAT_Width.value as string;CAT_NewAttrib[2].Width = CAT_PropRoll_Integer.CAT_Width.value as string -- CAT_NewAttrib[2].Height = CAT_PropRoll_Integer.CAT_Height.value as string;CAT_NewAttrib[2].Height = CAT_PropRoll_Integer.CAT_Height.value as string CAT_NewAttrib[2].Range = ("[" + CAT_PropRoll_Integer.CAT_UIRangeStart.value as string + ", " + CAT_PropRoll_Integer.CAT_UIRangeEnd.value as string + ", " + CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string + "]") Case CAT_PropRoll_Integer.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) ) ) ) "Slider":( CAT_NewAttrib[2] = CAT_UIItem UI:"Slider" Name:(Cat_CheckedText as string) String:Cat_UIText Case CAT_ParamRoll.CAT_Type.Selection of ( 1:( CAT_NewAttrib[2].Type = "Float" CAT_NewAttrib[2].Width = CAT_PropRoll_Float.CAT_Width.value as string -- CAT_NewAttrib[2].Height = CAT_PropRoll_Float.CAT_Height.value as string Case CAT_PropRoll_Float.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) CAT_NewAttrib[2].Orient = (if CAT_PropRoll_Float.CAT_Orient.state == True then "Vertical" Else "Horizontal") CAT_NewAttrib[2].Ticks = CAT_PropRoll_Float.CAT_Ticks.value as string CAT_NewAttrib[2].Range = ("[" + CAT_PropRoll_Float.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeDefault.value as string + "]") ) 2:( CAT_NewAttrib[2].Type = "Integer" CAT_NewAttrib[2].Width = CAT_PropRoll_Integer.CAT_Width.value as string -- CAT_NewAttrib[2].Height = CAT_PropRoll_Integer.CAT_Height.value as string Case CAT_PropRoll_Integer.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) CAT_NewAttrib[2].Orient = (if CAT_PropRoll_Integer.CAT_Orient.state == True then "Vertical" Else "Horizontal") CAT_NewAttrib[2].Ticks = CAT_PropRoll_Integer.CAT_Ticks.value as string CAT_NewAttrib[2].Range = ("[" + CAT_PropRoll_Integer.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string + "]") ) ) ) "DropDownList": ( CAT_NewAttrib[2] = CAT_UIItem UI:"DropdownList" Name:(Cat_CheckedText as string) String:Cat_UIText Type:"Array" CAT_NewAttrib[2].Width = CAT_PropRoll_Array.CAT_Width.value as string CAT_NewAttrib[2].Height = CAT_PropRoll_Array.CAT_Height.value as string Case CAT_PropRoll_Array.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) CAT_NewAttrib[2].Items = "'" + (substring Cat_CheckedText 2 (Cat_CheckedText.count-2)) + "Array'" CAT_NewAttrib[2].array = #() CAT_NewAttrib[2].array = CAT_PropRoll_Array.CAT_MyArray as array CAT_PropRoll_Array.CAT_MyArray = #() CAT_PropRoll_Array.CAT_AItems.items = #() ) "CheckBox":( CAT_NewAttrib[2] = CAT_UIItem UI:"CheckBox " Name:(Cat_CheckedText as string) String:Cat_UIText Type:"Boolean" CAT_NewAttrib[2].Width = CAT_PropRoll_Boolean.CAT_Width.value as string CAT_NewAttrib[2].Height = CAT_PropRoll_Boolean.CAT_Height.value as string Case CAT_PropRoll_Boolean.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) ) "CheckButton": ( CAT_NewAttrib[2] = CAT_UIItem UI:"CheckButton " Name:(Cat_CheckedText as string) String:Cat_UIText Type:"Boolean" CAT_NewAttrib[2].Width = CAT_PropRoll_Boolean.CAT_Width.value as string CAT_NewAttrib[2].Height = CAT_PropRoll_Boolean.CAT_Height.value as string Case CAT_PropRoll_Boolean.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) CAT_NewAttrib[2].HighLightColor = CAT_PropRoll_Boolean.CAT_Highlight.color as string ) "MapButton":( CAT_NewAttrib[2] = CAT_UIItem UI:"MapButton " Name:(Cat_CheckedText as string) String:Cat_UIText Type:"TextureMap" CAT_NewAttrib[2].Width = CAT_PropRoll_Material.CAT_Width.value as string CAT_NewAttrib[2].Height = CAT_PropRoll_Material.CAT_Height.value as string Case CAT_PropRoll_Material.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) ) "ColorPicker":( CAT_NewAttrib[2] = CAT_UIItem UI:"ColorPicker " Name:(Cat_CheckedText as string) String:Cat_UIText Type:"Color" CAT_NewAttrib[2].Width = CAT_PropRoll_Color.CAT_Width.value as string CAT_NewAttrib[2].Height = CAT_PropRoll_Color.CAT_Height.value as string Case CAT_PropRoll_Color.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) CAT_NewAttrib[2].Color = CAT_PropRoll_Color.CAT_DColor.Color as string ) "PickButton":( CAT_NewAttrib[2] = CAT_UIItem UI:"PickButton " Name:(Cat_CheckedText as string) String:Cat_UIText Type:"Node" CAT_NewAttrib[2].Width = CAT_PropRoll_Node.CAT_Width.value as string CAT_NewAttrib[2].Height = CAT_PropRoll_Node.CAT_Height.value as string Case CAT_PropRoll_Node.CAT_Align.state of ( 1:(CAT_NewAttrib[2].Align = "Left") 2:(CAT_NewAttrib[2].Align = "Right") 3:(CAT_NewAttrib[2].Align = "Center") ) ) ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Add new UI parametar -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_IsDeleting == False then ( CAT_UIString += (CAT_NewAttrib[2].UI + " " + CAT_NewAttrib[2].Name + " \"" + CAT_NewAttrib[2].String + "\" Width:" + CAT_NewAttrib[2].Width + " Height:" + CAT_NewAttrib[2].Height + " Align:#" + CAT_NewAttrib[2].Align + " Type:#" + CAT_NewAttrib[2].Type) CAT_UIString += (" Range:" + CAT_NewAttrib[2].Range + " Orient:#" + CAT_NewAttrib[2].Orient + " Ticks:" + CAT_NewAttrib[2].Ticks + " Items:" + CAT_NewAttrib[2].Items + " HighLightcolor:" + CAT_NewAttrib[2].HighLightColor) CAT_UIString += (" Color:" + CAT_NewAttrib[2].Color + "\n") ) CAT_UIEndString = ")\n" CAT_UIEndString += ")\n" -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Build Final Layout -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CUSTString += CAT_UIString CUSTString += CAT_UIEndString -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Add Custom Attribute to Object -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize on */ CAT_AttribName = "Custom_Attributes" /* Localize off */ CAT_AnyTrue = False CAT_HoldStack = modpanel.GetCurrentobject () -- CUSTString += "For i in 1 to selection.count do" -- CUSTString += "(Try(\n" Case CAT_DoneRoll.CAT_AddTo.selection of ( 1:(CUSTString += "CustAttributes.add Selection[1].BaseObject CAT_DEF #Unique") 2:(CUSTString += "CustAttributes.add Selection[1].modifiers[CAT_ModIndex] CAT_DEF #Unique \n") -- 3:(CUSTString += "CustAttributes.add Selection[1].material CAT_DEF #Unique \n") ) -- CUSTString +=")Catch())\n" If CAT_Debug == True then Format "%\n" (CUSTString + "\n") -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Clear Update and Delete handlers -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_IsDeleting = False -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Execute Command -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- If a material is being added too, The material swatch must be deselected. The Following method will do this automaticly -- if CAT_DoneRoll.CAT_AddTo.selection == 3 then -- ( -- Cat_MActive = Medit.GetActiveMtlSlot () -- If Cat_MActive == 24 then (Cat_NewMActive = (Cat_MActive - 1)) Else (Cat_NewMActive = (Cat_MActive + 1)) -- Medit.SetActiveMtlSlot Cat_NewMActive false -- ) -- Hold the selection Cat_TempHold = Selection as Array function_return_value = true /* Localize on */ If CAT_Debug != True then ( Try(Execute CUSTString) Catch ( MessageBox "Attribute Addition Error!" function_return_value = false ) ) Else Execute CUSTString /* Localize off */ Select Cat_TempHold if getCommandPanelTaskMode() != #Modify Then Max Modify Mode -- if CAT_DoneRoll.CAT_AddTo.selection == 3 then -- ( -- Medit.SetActiveMtlSlot Cat_MActive false -- ) ModPanel.SetCurrentObject CAT_HoldStack function_return_value ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Define Variables and Structs -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_ParamBlock_Array == undefined then CAT_ParamBlock_Array = #() If CAT_UIItems_Array == undefined then CAT_UIItems_Array = #() /* Localize on */ If Cat_CheckedText == undefined or Cat_CheckedText == "" do ( Cat_CheckedText = ("Param" + CAT_UINum as string) Cat_UIText = Cat_CheckedText ) /* Localize off */ -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Selecion Change Function (Enabled and Disable UI) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// fn Cat_SelChange = ( If Selection.count != 1 then ( CAT_DoneRoll.CAT_Add.enabled = False CAT_DoneRoll.CAT_AddTo.Enabled = False CAT_DoneRoll.CAT_Delete.Enabled = False ) Else ( CAT_DoneRoll.CAT_Add.enabled = True CAT_DoneRoll.CAT_AddTo.Enabled = True CAT_DoneRoll.CAT_Delete.Enabled = True ) Try (if CAT_DeleteUIRoll != undefined do DestroyDialog CAT_DeleteUIRoll)Catch() ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Reset Function -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FN Cat_Reset = ( Try ( CAT_UINum = undefined CAT_CheckedText = "" CAT_UIText = "" CloseRolloutFloater Cat_Float ) Catch() ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Check Definition Data -- This function is used to check the custom atrributes definition data, See if it exists -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// fn CAT_DefExist = ( if getCommandPanelTaskMode() != #Modify Then Max Modify Mode /* Localize on */ CAT_AttribName = "Custom_Attributes" /* Localize off */ Try( Case CAT_DoneRoll.CAT_AddTo.selection of ( 1:(CAT_Defs = CustAttributes.getdefs Selection[1].BaseObject) 2:(CAT_Defs = CustAttributes.getdefs Selection[1].modifiers[CAT_ModIndex]) 3:(CAT_Defs = CustAttributes.getdefs Selection[1].material) ) )CATCH() local res = false If CAT_Defs != undefined then ( For a in 1 to Cat_Defs.count where not res do res = (CAT_Defs[a].name as string) == CAT_AttribName ) res ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Set Definition Data -- This function is used to Set the custom atrributes definition data to the selected object -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// fn CAT_SetDef = ( If Debug == True then Format "%\n" ("------------------------------------------------------------- \n -- Set Definition Performed.. \n -------------------------------------------------------------") if getCommandPanelTaskMode() != #Modify Then Max Modify Mode /* Localize on */ CAT_AttribName = "Custom_Attributes" /* Localize off */ Case CAT_DoneRoll.CAT_AddTo.selection of ( 1:(CAT_Defs = CustAttributes.getdefs Selection[1].baseobject) 2:(CAT_Defs = CustAttributes.getdefs Selection[1].modifiers[CAT_ModIndex]) 3:(CAT_Defs = CustAttributes.getdefs Selection[1].material) ) If CAT_Defs != undefined then ( For a in 1 to Cat_Defs.count do ( if (CAT_Defs[a].name as string) == CAT_AttribName then ( custAttributes.setDefData CAT_Defs[a] (CAT_Source as array) ) ) ) if Debug == True then Format "%\n" ("CAT_NewAttrib from CAT_Setdef ():" + CAT_NewAttrib as string) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Get Definition Data -- This function is used to retrieve the custom atrributes definition data from the selected object -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// fn CAT_GetDef = ( Case CAT_DoneRoll.CAT_AddTo.selection of ( 2:(Try(CAT_ModIndex = modpanel.getModifierIndex Selection[1] (modpanel.getcurrentObject ()))Catch()) ) If Debug == True then Format "%\n" ("------------------------------------------------------------- \n -- Get Definition Performed.. \n -------------------------------------------------------------") if getCommandPanelTaskMode() != #Modify Then Max Modify Mode /* Localize on */ CAT_AttribName = "Custom_Attributes" /* Localize off */ CAT_ParamBlock_Array = #() CAT_UIItems_Array = #() CAT_Source = #() CAT_NewAttrib = #() CAT_UI_Array = #() Case CAT_DoneRoll.CAT_AddTo.selection of ( 1:(CAT_Defs = CustAttributes.getdefs Selection[1].BaseObject) 2:(CAT_Defs = CustAttributes.getdefs Selection[1].modifiers[CAT_ModIndex]) 3:(CAT_Defs = CustAttributes.getdefs Selection[1].material) ) If CAT_Defs == Undefined then CAT_Defs = #() For a in 1 to Cat_Defs.count do ( if (CAT_Defs[a].name as string) == CAT_AttribName then ( CAT_CurrentDef = CAT_Defs[a] CAT_DefData = CAT_Defs[a].defdata CAT_ParamBlock_Array = CAT_DefData[1] CAT_UIItems_Array = CAT_DefData[2] CAT_UI_Array = #() CAT_Source[1] = CAT_ParamBlock_Array as array CAT_Source[2] = CAT_UIItems_Array as array For i in 1 to CAT_DefData[2].count do ( Append CAT_UI_Array (CAT_DefData[2][i].UI as string + " ---- " + CAT_DefData[2][i].String as string) ) ) Else ( /* Localize on */ CAT_CurrentDef == "Deleted" /* Localize off */ ) ) /* Localize on */ If Cat_Defs.count == 0 or Cat_CurrentDef == "Deleted" then (CAT_UI_Array = #()) /* Localize off */ If Cat_Debug == True then Format "%\n" CAT_UIItems_Array If Debug == True then Format "%\n" ("CAT_NewAttrib from CAT_GetDef() :" + CAT_Source as string) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Paramblock Definition -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FN CAT_TextChecker t = ( str = "\"" location = findString t str master_location = 0 while location != undefined do ( master_location += location t = replace t master_location 1 "\\\"" location = findString (subString t (master_location + 2) -1) str master_location += 1 ) Cat_UIText = t str = "'" master_location = 0 location = findString t str while location != undefined do ( if location == 1 or location == t.count then (t = replace t location 1 "") else (t = replace t location 1 "_") location = findString t str ) Cat_CheckedText = "'" + t + "'" ) FN CAT_Set_Roll_Float = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Integer CAT_Float)Catch() AddRollout CAT_PropRoll_Float CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.items = #("Spinner", "Slider") CAT_ParamRoll.CAT_UIType.selection = 1 Cat_EvalUI () ) FN CAT_Set_Roll_Boolean = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Float CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Integer CAT_Float)Catch() AddRollout CAT_PropRoll_Boolean CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.items = #("CheckBox", "CheckButton") CAT_ParamRoll.CAT_UIType.selection = 1 Cat_EvalUI() ) FN CAT_Set_Roll_Integer = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Float CAT_Float)Catch() AddRollout CAT_PropRoll_Integer CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.items = #("Spinner", "Slider") CAT_ParamRoll.CAT_UIType.selection = 1 Cat_EvalUI() ) FN CAT_Set_Roll_Array = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Float CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Integer CAT_Float)Catch() AddRollout CAT_PropRoll_Array CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.selection = 1 CAT_ParamRoll.CAT_UIType.items = #("DropDownList") Cat_EvalUI() ) FN CAT_Set_Roll_Node = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Float CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Integer CAT_Float)Catch() AddRollout CAT_PropRoll_Node CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.items = #("PickButton") CAT_ParamRoll.CAT_UIType.selection = 1 Cat_EvalUI() ) FN CAT_Set_Roll_Color = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Float CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Integer CAT_Float)Catch() AddRollout CAT_PropRoll_Color CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.items = #("ColorPicker") CAT_ParamRoll.CAT_UIType.selection = 1 Cat_EvalUI() ) FN CAT_Set_Roll_TextureMap = ( Try(RemoveRollout CAT_TestRoll CAT_Float)Catch() Try(RemoveRollout CAT_DoneRoll CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Boolean CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Array CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Color CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Node CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Material CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Float CAT_Float)Catch() Try(RemoveRollout CAT_PropRoll_Integer CAT_Float)Catch() AddRollout CAT_PropRoll_Material CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float CAT_ParamRoll.CAT_UIType.items = #("MapButton") CAT_ParamRoll.CAT_UIType.selection = 1 Cat_EvalUI() ) -- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Function for initializing the Edits -- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FN CAT_Edit_Set i = ( CAT_ParamRoll.CAT_UIName.text = CAT_UIItems_Array[i].string Case CAT_UIItems_Array[i].type of ( "Float":( CAT_Set_Roll_Float () CAT_ParamRoll.CAT_Type.selection = 1 CAT_PropRoll_Float.CAT_Width.value = CAT_UIItems_Array[i].Width as float CAT_PropRoll_Float.CAT_UIRangeStart.value = (execute (CAT_UIItems_Array[i].Range)).x as float CAT_PropRoll_Float.CAT_UIRangeEnd.value = (execute (CAT_UIItems_Array[i].Range)).y as float CAT_PropRoll_Float.CAT_UIRangeDefault.value = (execute (CAT_UIItems_Array[i].Range)).z as float Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Float.CAT_Align.State = 1) "Right":(CAT_PropRoll_Float.CAT_Align.State = 2) "Center":(CAT_PropRoll_Float.CAT_Align.State = 3) ) Case CAT_UIItems_Array[i].UI of ( "Spinner":(CAT_ParamRoll.CAT_UIType.selection = 1) "Slider":(CAT_ParamRoll.CAT_UIType.selection = 2) ) Case CAT_UIItems_Array[i].orient of ( "Horizontal":( CAT_PropRoll_Float.CAT_Orient.state = False CAT_PropRoll_Float.CAT_Orient.Enabled = False CAT_PropRoll_Float.CAT_Ticks.Enabled = False ) "Vertical":( CAT_PropRoll_Float.CAT_Orient.state = True CAT_PropRoll_Float.CAT_Orient.Enabled = True CAT_PropRoll_Float.CAT_Ticks.Enabled = True ) ) CAT_PropRoll_Float.CAT_Ticks.value = CAT_UIItems_Array[i].ticks as integer CAT_EvalUI() ) "Integer":( CAT_Set_Roll_Integer() CAT_ParamRoll.CAT_Type.selection = 2 CAT_PropRoll_Integer.CAT_Width.value = CAT_UIItems_Array[i].Width as integer CAT_PropRoll_Integer.CAT_UIRangeStart.value = (execute (CAT_UIItems_Array[i].Range)).x as integer CAT_PropRoll_Integer.CAT_UIRangeEnd.value = (execute (CAT_UIItems_Array[i].Range)).y as integer CAT_PropRoll_Integer.CAT_UIRangeDefault.value = (execute (CAT_UIItems_Array[i].Range)).z as integer Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Integer.CAT_Align.State = 1) "Right":(CAT_PropRoll_Integer.CAT_Align.State = 2) "Center":(CAT_PropRoll_Integer.CAT_Align.State = 3) ) Case CAT_UIItems_Array[i].UI of ( "Spinner":(CAT_ParamRoll.CAT_UIType.selection = 1) "Slider":(CAT_ParamRoll.CAT_UIType.selection = 2) ) Case CAT_UIItems_Array[i].orient of ( "Horizontal":( CAT_PropRoll_Integer.CAT_Orient.state = False CAT_PropRoll_Integer.CAT_Orient.Enabled = False CAT_PropRoll_Integer.CAT_Ticks.Enabled = False ) "Vertical":( CAT_PropRoll_Integer.CAT_Orient.state = True CAT_PropRoll_Integer.CAT_Orient.Enabled = True CAT_PropRoll_Integer.CAT_Ticks.Enabled = True ) ) CAT_PropRoll_Integer.CAT_Ticks.value = CAT_UIItems_Array[2].ticks as integer CAT_EvalUI() ) "Boolean":( CAT_Set_Roll_Boolean () CAT_ParamRoll.CAT_Type.selection = 3 CAT_PropRoll_Boolean.CAT_Width.value = CAT_UIItems_Array[i].Width as integer CAT_PropRoll_Boolean.CAT_Height.value = CAT_UIItems_Array[i].Height as integer Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Boolean.CAT_Align.State = 1) "Right":(CAT_PropRoll_Boolean.CAT_Align.State = 2) "Center":(CAT_PropRoll_Boolean.CAT_Align.State = 3) ) Case CAT_UIItems_Array[i].UI of ( "CheckBox ":( CAT_ParamRoll.CAT_UIType.selection = 1 CAT_PropRoll_Boolean.CAT_Highlight.enabled = False CAT_PropRoll_Boolean.CAT_Highlight.color = (execute (CAT_UIItems_Array[i].HighLightColor)) ) "CheckButton ":( CAT_ParamRoll.CAT_UIType.selection = 2 CAT_PropRoll_Boolean.CAT_Highlight.enabled = True CAT_PropRoll_Boolean.CAT_Highlight.color = (execute (CAT_UIItems_Array[i].HighLightColor)) ) ) CAT_EvalUI() ) "Array":( CAT_Set_Roll_Array() CAT_ParamRoll.CAT_Type.selection = 4 CAT_PropRoll_Array.CAT_Width.value = CAT_UIItems_Array[i].Width as integer CAT_PropRoll_Array.CAT_Height.value = CAT_UIItems_Array[i].Height as integer Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Array.CAT_Align.State = 1) "Right":(CAT_PropRoll_Array.CAT_Align.State = 2) "Center":(CAT_PropRoll_Array.CAT_Align.State = 3) ) CAT_PropRoll_Array.CAT_AItems.Items = CAT_UIItems_Array[i].Array CAT_PropRoll_Array.CAT_MYArray = CAT_UIItems_Array[i].Array CAT_EvalUI() ) "Node":( CAT_Set_Roll_Node () CAT_ParamRoll.CAT_Type.selection = 5 CAT_PropRoll_Node.CAT_Width.value = CAT_UIItems_Array[i].Width as integer CAT_PropRoll_Node.CAT_Height.value = CAT_UIItems_Array[i].Height as integer Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Node.CAT_Align.State = 1) "Right":(CAT_PropRoll_Node.CAT_Align.State = 2) "Center":(CAT_PropRoll_Node.CAT_Align.State = 3) ) CAT_EvalUI() ) "Color":( CAT_Set_Roll_Color () CAT_ParamRoll.CAT_Type.selection = 6 CAT_PropRoll_Color.CAT_Width.value = CAT_UIItems_Array[i].Width as integer CAT_PropRoll_Color.CAT_Height.value = CAT_UIItems_Array[i].Height as integer Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Color.CAT_Align.State = 1) "Right":(CAT_PropRoll_Color.CAT_Align.State = 2) "Center":(CAT_PropRoll_Color.CAT_Align.State = 3) ) CAT_PropRoll_Color.CAT_DColor.Color = (execute (CAT_UIItems_Array[i].Color)) CAT_EvalUI() ) "TextureMap":( CAT_Set_Roll_TextureMap() CAT_ParamRoll.CAT_Type.selection = 7 CAT_PropRoll_Material.CAT_Width.value = CAT_UIItems_Array[i].Width as integer CAT_PropRoll_Material.CAT_Height.value = CAT_UIItems_Array[i].Height as integer Case CAT_UIItems_Array[i].Align of ( "Left":(CAT_PropRoll_Material.CAT_Align.State = 1) "Right":(CAT_PropRoll_Material.CAT_Align.State = 2) "Center":(CAT_PropRoll_Material.CAT_Align.State = 3) ) CAT_EvalUI() ) ) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Funtion for Editing UI Elements -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// FN CAT_EditUI = ( /* Localize on */ Rollout CAT_EditUIRoll "Edit Attribute" SilentErrors:(CAT_Debug != True) ( ListBox CAT_UIList "Attributes:" Button CAT_EditUI_OK "Edit Selected" Across:2 Align:#Right Offset:[35,0] Button CAT_EditUI_Cancel "Close" Align:#Right /* Localize off */ On CAT_UIList selected i do ( CAT_Edit_Set i ) On CAT_EditUI_OK pressed do ( -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is where the delete selected button action takes place. -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If Debug == True then Format "%\n" ("Current Def Data Information Defore Edit = " + CAT_Source as string) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This is where the Paramblock and UI edits take place. -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_UIItems_Array[CAT_UIList.selection].string = Cat_UIText --CAT_TextChecker CAT_ParamRoll.CAT_UIName.text --CAT_ParamBlock_Array[CAT_UIList.selection].UI = CAT_CheckedText --CAT_ParamBlock_Array[CAT_UIList.selection].UI = CAT_CheckedText Case CAT_ParamRoll.CAT_UIType.selected of ( "Spinner":( /* Localize on */ Format "%\n" "Spinner Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = CAT_ParamRoll.CAT_UIType.selected CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected Case CAT_ParamRoll.CAT_Type.selected of ( "Integer":( CAT_UIItems_Array[CAT_UIList.selection].Range = ("[" + CAT_PropRoll_Integer.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string + "]") CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Integer.CAT_Width.value as string Case CAT_PropRoll_Float.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Integer" CAT_ParamBlock_Array[CAT_UIList.selection].Default = CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string ) "Float":( CAT_UIItems_Array[CAT_UIList.selection].Range = ("[" + CAT_PropRoll_Float.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeDefault.value as string + "]") CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Float.CAT_Width.value as string Case CAT_PropRoll_Float.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Float" CAT_ParamBlock_Array[CAT_UIList.selection].Default = CAT_PropRoll_Float.CAT_UIRangeDefault.value as string ) ) ) "Slider":( /* Localize on */ Format "%\n" "Slider Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = CAT_ParamRoll.CAT_UIType.selected CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected Case CAT_ParamRoll.CAT_Type.selected of ( "Integer":( CAT_UIItems_Array[CAT_UIList.selection].Range = ("[" + CAT_PropRoll_Integer.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Integer.CAT_UIRangeDefault.value as string + "]") CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Integer.CAT_Width.value as string Case CAT_PropRoll_Float.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Integer" ) "Float":( CAT_UIItems_Array[CAT_UIList.selection].Range = ("[" + CAT_PropRoll_Float.CAT_UIRangeStart.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeEnd.value as string + "," + CAT_PropRoll_Float.CAT_UIRangeDefault.value as string + "]") CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Float.CAT_Width.value as string Case CAT_PropRoll_Float.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Float" ) ) ) "CheckBox":( /* Localize on */ Format "%\n" "Checkbox Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = CAT_ParamRoll.CAT_UIType.selected CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Boolean.CAT_Width.value as string CAT_UIItems_Array[CAT_UIList.selection].Height = CAT_PropRoll_Boolean.CAT_Height.value as string Case CAT_PropRoll_Boolean.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Boolean" CAT_ParamBlock_Array[CAT_UIList.selection].Default = "False" ) "CheckButton":( /* Localize on */ Format "%\n" "Checkbutton Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = CAT_ParamRoll.CAT_UIType.selected CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Boolean.CAT_Width.value as string CAT_UIItems_Array[CAT_UIList.selection].Height = CAT_PropRoll_Boolean.CAT_Height.value as string CAT_UIItems_Array[CAT_UIList.selection].HighlightColor = CAT_PropRoll_Boolean.CAT_Highlight.color as string Case CAT_PropRoll_Boolean.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Boolean" CAT_ParamBlock_Array[CAT_UIList.selection].Default = "False" ) "ColorPicker":( /* Localize on */ Format "%\n" "Colorpicker Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = CAT_ParamRoll.CAT_UIType.selected CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Color.CAT_Width.value as string CAT_UIItems_Array[CAT_UIList.selection].Height = CAT_PropRoll_Color.CAT_Height.value as string CAT_UIItems_Array[CAT_UIList.selection].Color = ("[" + CAT_PropRoll_Color.CAT_DColor.Color.R as string + "," + CAT_PropRoll_Color.CAT_DColor.Color.G as string + "," + CAT_PropRoll_Color.CAT_DColor.Color.B as string + "]") Case CAT_PropRoll_Color.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Color" CAT_ParamBlock_Array[CAT_UIList.selection].Default = CAT_UIItems_Array[CAT_UIList.selection].Color ) "PickButton":( /* Localize on */ Format "%\n" "Pickbutton Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = "PickButton" CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Node.CAT_Width.value as string CAT_UIItems_Array[CAT_UIList.selection].Height = CAT_PropRoll_Node.CAT_Height.value as string Case CAT_PropRoll_Node.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Node" ) "MapButton":( /* Localize on */ Format "%\n" "Mapbutton Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = CAT_ParamRoll.CAT_UIType.selected CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Material.CAT_Width.value as string CAT_UIItems_Array[CAT_UIList.selection].Height = CAT_PropRoll_Material.CAT_Height.value as string Case CAT_PropRoll_Color.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "TextureMap" ) "DropDownList":( /* Localize on */ Format "%\n" "Dropdownlist Edited" /* Localize off */ CAT_UIItems_Array[CAT_UIList.selection].UI = "DropdownList" CAT_UIItems_Array[CAT_UIList.selection].Type = CAT_ParamRoll.CAT_Type.selected CAT_UIItems_Array[CAT_UIList.selection].Width = CAT_PropRoll_Array.CAT_Width.value as string CAT_UIItems_Array[CAT_UIList.selection].Height = CAT_PropRoll_Array.CAT_Height.value as string CAT_UIItems_Array[CAT_UIList.selection].Array = CAT_PropRoll_Array.CAT_MyArray Case CAT_PropRoll_Array.CAT_Align.State of ( 1:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Left") 2:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Right") 3:(CAT_UIItems_Array[CAT_UIList.selection].Align = "Center") ) CAT_ParamBlock_Array[CAT_UIList.selection].Type = "Integer" CAT_ParamBlock_Array[CAT_UIList.selection].Default = "1" ) ) -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- CAT_NewAttrib is the source for defdata, CAT_NewAttrib[1] is the paramblock array, CAT_NewAttrib[2] is the UI items associated with the paramblock. This is what is associated -- in the the defdata of the object. -- -- Once the item is deleted, A new CAT_NewAttrib is made and the array are stuffed into CAT_NewAttrib[1] and CAT_NewAttrib[2] -- The Current definition is then set back to the current definition, "CAT_CurrentDef.Defdata = CAT_NewAttrib" -- CAT_CurrentDef is the current custom attribute and is retrieved whenever CAT_GetDef() is called on the selected object. -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// undo "Edit CA" on ( CAT_Source[1] = CAT_ParamBlock_Array as array CAT_Source[2] = CAT_UIItems_Array as array Cat_SetDef() -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- This flag is set to tell tha Cat_AddUI funtion that we are currently deleting -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_IsDeleting = True -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- CAT_AddUI is the function that adds the actually custom attribute -- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If Debug == True then Format "%\n" ("Current Def Data Information after Editing = " + CAT_Source as string) CAT_AddUI () DestroyDialog CAT_EditUIRoll CAT_GetDef() (CreateDialog CAT_EditUIRoll Pos:([CAT_Float.Pos.x + 225, CAT_Float.Pos.y + 250]) Width:200 Height:200) ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Update Delete List Box -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_UIList.items = CAT_UI_Array ) On CAT_EditUI_Cancel pressed Do ( DestroyDialog CAT_EditUIRoll ) ) CAT_GetDef() CreateDialog CAT_EditUIRoll Pos:([CAT_Float.Pos.x + 225, CAT_Float.Pos.y + 250]) Width:200 Height:220 CAT_EditUIRoll.CAT_UIList.Items = CAT_UI_Array CAT_Edit_Set 1 ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- UI Items Definition --- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Struct CAT_ParamBlock ( Name, Type, UI, Default = "" ) Struct CAT_UIItem ( UI, Name, String, Type, Range = "[0,100,0]", Default = "1", Width = "70", Height = "25", Enabled = "True", Orient = "Horizontal", Checked = "False", Color = "[0,0,0]", HighLightColor = "[0,255,0]", Align = "Left", Items = "#()", Ticks = "10", Array = #() ) -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Define Valid Parameter Characters -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /* Localize on */ -- CAT_ValidCharacters = #(" ","_","1","2","3","4","5","6","7","8","9","0","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z") /* Localize off */ -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Open up UI and addrollouts -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// If CAT_Float != undefined then CloseRolloutFloater CAT_Float If CAT_UI_Size == undefined then CAT_UI_Size = [225, 470] If CAT_UI_Pos == undefined then CAT_UI_Pos = [0, 0] IF CAT_CheckedText == undefined or CAT_CheckedText == "" do ( CAT_CheckedText = "Param1" Cat_UIText = Cat_CheckedText ) If CAT_Float_State == undefined then CAT_Float_State = True If CAT_Integer_State == undefined then CAT_Integer_State = True If CAT_Boolean_State == undefined then CAT_Boolean_State = True If CAT_Array_State == undefined then CAT_Array_State = True If CAT_Color_State == undefined then CAT_Color_State = True If CAT_Node_State == undefined then CAT_Node_State = True If CAT_Material_State == undefined then CAT_Material_State = True /* Localize on */ CAT_Float = NewRolloutFloater "Add Parameter" CAT_UI_Size.X CAT_UI_Size.Y CAT_UI_Pos.X CAT_UI_Pos.Y /* Localize off */ AddRollout CAT_ParamRoll CAT_Float AddRollout CAT_PropRoll_Float CAT_Float AddRollout CAT_DoneRoll CAT_Float AddRollout CAT_TestRoll CAT_Float -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Create Selection handler -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Callbacks.RemoveScripts ID:#CAT_Callback_Reset Callbacks.Addscript #selectionSetChanged "Cat_SelChange ()" ID:#CAT_Callback Callbacks.Addscript #systemPreReset "Cat_Reset ()" ID:#CAT_Callback_Reset Callbacks.Addscript #filePreOpen "Cat_Reset ()" ID:#CAT_Callback_Reset Callbacks.Addscript #systemPreNew "Cat_Reset ()" ID:#CAT_Callback_Reset CAT_SelChange () -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- Clear Update and Delete handlers -- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CAT_IsDeleting = False )