Jump to content

Mod Tool/Scripting: Difference between revisions

Seems Event OnActivate will be the method of choice to let XSI ask OniSplit GUI whether there are new tasks or updated resources.
m (hard error on PPG when minimum value is too low)
(Seems Event OnActivate will be the method of choice to let XSI ask OniSplit GUI whether there are new tasks or updated resources.)
Line 128: Line 128:


[...]
[...]
===Events===
====OnActivate====
function siOnActivateEventTest_OnEvent( in_ctxt )
Application.LogMessage "State: " + cstr(in_ctxt.GetAttribute("State"))
' TODO: Put your code here.
' Return value is ignored as this event can not be aborted.
siOnActivateEventTest_OnEvent = true
end function
:State becomes "False" when XSI loses its focus.
:State becomes "True" when XSI regains focus.
Exchanging data between XSI and other programs is rather difficult.
Instead, whenever "True" is detected XSI could look into an exchange folder or exchange file*.
: *OniSplit GUI could save a vbs script to file and then it gets executed by XSI
:: Application.ExecuteScript( FileName, [Language], [ProcName], [Params] )
Full example (FillFile would have to be done by the GUI)
Dim fso, wText, bInteractive, TestFile
TestFile="C:\Oni\AE\Tools\Simple_OniSplit_GUI\XSI_exchange\test.vbs"
Main()
'------------------------------------------------------------------------------
' NAME: FillFile
'
' INPUT:
'
' DESCRIPTION: Fill the test file
'------------------------------------------------------------------------------
sub FillFile (in_file)
  wText.WriteLine "Main()"
  wText.WriteLine ""
  wText.WriteLine "sub log_some_messages(an_int, a_string)"
  wText.WriteLine "logmessage ""the int : "" & an_int"
  wText.WriteLine "logmessage ""the string : "" & a_string"
  wText.WriteLine "end sub"
  wText.WriteLine ""
  wText.WriteLine "sub main()"
  wText.WriteLine "CreatePrim ""Sphere"", ""NurbsSurface"""
  wText.WriteLine "end sub"
  wText.Close
end sub
sub main()
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set wText = fso.CreateTextFile( TestFile, 1)
  FillFile TestFile
  ExecuteScript TestFile
  dim aParams
  aParams = Array(123456789, "toto")
  ExecuteScript TestFile,,"log_some_messages", aParams
end sub




Line 841: Line 908:




==Softimage-specific stuff==
==Check selection mode==
===Check selection mode===
  checkfilter
  checkfilter
  'use sub to make use of the exit command
  'use sub to make use of the exit command
Line 864: Line 930:
  end sub
  end sub


===Property Page===
==Property Page==
====Detect a PPG====
===Detect a PPG===
  ' this check is used to decide to either build or open a PPG
  ' this check is used to decide to either build or open a PPG
  set oRoot = ActiveProject.ActiveScene.Root
  set oRoot = ActiveProject.ActiveScene.Root
Line 875: Line 941:




====Disable PPG popups====
===Disable PPG popups===
  ' let's say a big amount of objects will be created and each object will open a PPG
  ' let's say a big amount of objects will be created and each object will open a PPG
  ' in that case for user convenience those PPG popups should be disabled
  ' in that case for user convenience those PPG popups should be disabled
Line 889: Line 955:




====Build a PPG====
===Build a PPG===
  ' general PPG setup
  ' general PPG setup
  set oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "my_PPG")
  set oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "my_PPG")
Line 901: Line 967:




====PPG content====
===PPG content===
=====Text input=====
====Text input====
  oPSet.AddParameter3 "ParamName", siString
  oPSet.AddParameter3 "ParamName", siString
  oPPGLayout.AddItem "ParamName", "Caption"
  oPPGLayout.AddItem "ParamName", "Caption"




=====Integer input=====
====Integer input====
  oPSet.AddParameter3 "ParamName", siInt2, , , , false, 0
  oPSet.AddParameter3 "ParamName", siInt2, , , , false, 0
  oPPGLayout.AddItem "ParamName", "Caption"
  oPPGLayout.AddItem "ParamName", "Caption"
Line 919: Line 985:




=====Droplist=====
====Droplist====
  oPSet.AddParameter3 "Team", siString, 0
  oPSet.AddParameter3 "Team", siString, 0
  aListTeams = Array( "Konoko", 0, _
  aListTeams = Array( "Konoko", 0, _
Line 932: Line 998:




=====Radio options=====
====Radio options====
  oPSet.AddParameter3 "Team", siString, 0
  oPSet.AddParameter3 "Team", siString, 0
  aListTeams = Array( "Konoko", 0, _
  aListTeams = Array( "Konoko", 0, _
Line 945: Line 1,011:




=====Checkbox=====
====Checkbox====
  ' create checkbox and remove key symboles by setting parameter "Animatable" to false or 0
  ' create checkbox and remove key symboles by setting parameter "Animatable" to false or 0
  ' CustomProperty.AddParameter3( ScriptName, ValueType, [DefaultValue], [Min], [Max], [Animatable], [ReadOnly] )
  ' CustomProperty.AddParameter3( ScriptName, ValueType, [DefaultValue], [Min], [Max], [Animatable], [ReadOnly] )
Line 952: Line 1,018:




=====Spacer=====
====Spacer====
  ' AddSpacer( [Width], [Height] )
  ' AddSpacer( [Width], [Height] )
  oPPGLayout.AddSpacer 25
  oPPGLayout.AddSpacer 25




===Softimage ICE===
==Softimage ICE==
====Show a simple value in the viewport====
===Show a simple value in the viewport===
  CreatePrim "Cube", "MeshSurface"
  CreatePrim "Cube", "MeshSurface"
   
   
8,330

edits