Mod Tool/Scripting: Difference between revisions

+ OnValueChange event
(Seems Event OnActivate will be the method of choice to let XSI ask OniSplit GUI whether there are new tasks or updated resources.)
(+ OnValueChange event)
Line 132: Line 132:
===Events===
===Events===
====OnActivate====
====OnActivate====
  function siOnActivateEventTest_OnEvent( in_ctxt )
  function siOnActivateEventTest_OnEvent( in_ctxt )
  Application.LogMessage "State: " + cstr(in_ctxt.GetAttribute("State"))
  Application.LogMessage "State: " + cstr(in_ctxt.GetAttribute("State"))
Line 140: Line 139:
  end function
  end function


:State becomes "False" when XSI loses its focus.
'''State becomes "False" when XSI loses its focus.'''
:State becomes "True" when XSI regains focus.
 
'''State becomes "True" when XSI regains focus.'''


Exchanging data between XSI and other programs is rather difficult.
Exchanging data between XSI and other programs is rather difficult.
Line 195: Line 195:
  end sub
  end sub


====OnValueChange====
' this event is fired 4 times (2 local, 2 global)
' everytime when created, translated, rotated, or scaled
' we only want one global
firstValue = false
function siOnValueChangeEventTest_OnEvent( in_ctxt )
if instr(cstr(in_ctxt.GetAttribute("Object")), ".kine.global") > 0 then
  if firstValue = false then
 
  ' add more exit conditions here
  ' e.g. selection mode
  ' selection count
  ' if obj is not an Oni obj or camera
    logmessage "Object at: " & selection(0).posx.value & " " & selection(0).posy.value & " " & selection(0).posz.value
    if replace(cstr(in_ctxt.GetAttribute("Object")),".kine.global", "") = "Camera" then
    logmessage "Obj is cam"
    end if
    firstValue = true
  else
firstValue = false
  end if
end if
end function
' INFO : Object at: -22,0187049984705 6,63004918144234 5,08830153431981
' INFO : Obj is cam
This could be used to track camera and sound spheres positions. They values could be passed as command line argument to GUI.




8,323

edits