Graphics

 View Only
  • 1.  Trigger Scene Director from Data

    Posted 09-13-2018 23:19

    Hello -

    I wrote this script to trigger two different animations when a value is changed via datalinq.

    dim Ani1Out, Ani1In as xpSceneDirector

    scene.GetSceneDirectorByName("Item1Out", Ani1Out)
    scene.GetSceneDirectorByName("Item1In", Ani1In)

    if self.text = "1" then
    Ani1In.playrange(0, Ani1In.duration)

    else if self.text = "2" then
    Ani1Out.playrange(0, Ani1Out.duration)
    end if



    The Item1Out plays when the value is changed away from 2 not changed to 2. IE. if I go from 1 to 2 nothing plays but if I go from 2 to 1 Ani1Out = Item1out plays. Can someone explain why its not playing when the value changes to 2?

    Thanks!



  • 2.  RE: Trigger Scene Director from Data

    Posted 09-13-2018 23:20
    Forgot to add - this script is on 'OnSetText'
    #XPression


  • 3.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 01:45
    Remove the "self." part.. It should just be "text". "text" represents the new text ABOUT to be set onto the text object, but it hasn't actually be set onto the object yet.
    By putting "self.text" you are actually checking what the old value of the text object had.

    #XPression


  • 4.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 16:03
    @bford That makes sense, never knew that. I'm still having the same issue though. Is there something else that could be hanging it up?
    #XPression


  • 5.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 16:06
    Share a dropbox or google drive link to your scene and we can look at it for you.
    #XPression


  • 6.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 16:09
    When i input 2 it plays the correct scene director now. When i input 1, it only works when the scene first comes online.
    #XPression


  • 7.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 16:20


  • 8.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 18:15
    Found the issue. Since those two scene directors are keyframing the same objects once they hit their end, they actually continue updating the object to be in the spot determined by the last keyframe. To avoid this, you can either add an event to the end of each of those scene directors. The event should be set to "STOP" and turn on the "relative" checkbox so it doesnt jump back to frame 0. The stop will stop the scene director from controlling that object.

    Or easier, from script; just set the autostop property on the scene director before calling playrange.. Like this:


    dim Ani1Out, Ani1In as xpSceneDirector

    scene.GetSceneDirectorByName("Item1Out", Ani1Out)
    scene.GetSceneDirectorByName("Item1In", Ani1In)

    if text = "3" then
    Ani1In.Autostop=true
    Ani1In.playrange (0, Ani1In.duration)

    else if text = "2" then
    Ani1Out.Autostop=true
    Ani1Out.playrange (0, Ani1Out.duration)
    end if

    #XPression


  • 9.  RE: Trigger Scene Director from Data

    Posted 09-14-2018 18:51
    Thanks - that helps me understand the conflict happening. Thanks!
    #XPression