Mod Tool: Difference between revisions

2,793 bytes added ,  19 October 2012
m
scripting: property page (PPG)
mNo edit summary
m (scripting: property page (PPG))
Line 881: Line 881:
  ' now you can work with the extracted xml file
  ' now you can work with the extracted xml file


{| border=0 cellpadding=0 align=right
| [http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XSI_modding/PPG_zpsda38090b.png http://i305.photobucket.com/albums/nn207/unknownfuture/Oni_Galore_Images/XSI_modding/PPG_tn_zps84e07fe6.png]
|}


  ' '''[21] building a form (PPG)'''
  ' '''[21] building a form (PPG)'''
dim oPSet, oPPGLayout, oItem, PPG_exist
' set check value to 0
PPG_exist = 0
' check if PPG exists
for each prop in ActiveProject.ActiveScene.Root.Properties
logmessage prop.name
if instr(1, prop.name, "my_new_PPG") > 0 then
PPG_exist = 1
logmessage "found " & """" & prop.name & """"
end if
next
' create PPG if it doesn't exist
if PPG_exist = 0 then
set oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "my_new_PPG")
set oPPGLayout = oPSet.PPGLayout
' setup PPG parameters
' ###################################################################################
' create checkbox and remove key symboles by setting parameter "Animatable" to false
oPSet.AddParameter3 "Check1", siBool, 0, , , false
oPSet.AddParameter3 "Check2", siBool, 0, , , false
oPSet.AddParameter3 "Check3", siBool, 1, , , false
oPSet.AddParameter3 "Check4", siBool, 1, , , false
oPSet.AddParameter3 "text1", siString
' last parameter of "int1" is set to ReadOnly
oPSet.AddParameter3 "int1", siInt2, , , , false, 1
oPSet.AddParameter3 "int2", siInt2, , , , false, 0
' add PPG items
' ###################################################################################
oPPGLayout.AddItem "text1", "Hi there!"
oPPGLayout.AddItem "int1", "number 1"
oPPGLayout.AddItem "int2", "number 2"
oPPGLayout.AddGroup "4 checkboxes", true
oPPGLayout.AddRow
oPPGLayout.AddItem "Check1", "C1"
oPPGLayout.AddItem "Check3", "C3"
oPPGLayout.EndRow
oPPGLayout.AddRow
oPPGLayout.AddItem "Check2", "C2"
oPPGLayout.AddItem "Check4", "C4"
oPPGLayout.EndRow
oPPGLayout.EndGroup
oPPGLayout.AddButton("log_values", "log PPG values").setAttribute siUICX, 120
oPPGLayout.Logic = "sub log_values_OnClicked" & vbCrlf & _
" logmessage ""text 1 = "" & getvalue(""my_new_PPG.text1"")" & vbCrlf & _
" logmessage ""number 1 = "" & getvalue(""my_new_PPG.int1"")" & vbCrlf & _
" logmessage ""C1 = "" & getvalue(""my_new_PPG.Check1"")" & vbCrlf & _
" end sub"
oPPGLayout.Language = "VBScript" 'Optional because this is the default
' open PPG
InspectObj oPSet
else
' open that PPG if it already exist
InspectObj "my_new_PPG"
end if
' set values from outside the PPG
setvalue "my_new_PPG.text1", "any text could stand here"
setvalue "my_new_PPG.int1", "42"
setvalue "my_new_PPG.check1", true
' get values from outside the PPG
logmessage getvalue("my_new_PPG.text1")
logmessage getvalue("my_new_PPG.int1")
logmessage getvalue("my_new_PPG.check1")




8,452

edits