Graphics

 View Only
Expand all | Collapse all

Scripting or Visual Logic

  • 1.  Scripting or Visual Logic

    Posted 11-25-2019 21:10

    I've been working on a scene that incorporates a lower third and multiple flags to appear with the lower third, depending on when the functionality is needed. I'm trying to figure out how to drive the scene director for each of those flags as a toggle or visibility on/off in the Template Data tab in the Sequence view. I've set up Visual Logic so that if the visibility of the flag's object group is set on, then the flag will come in with the in transition for the scene. Ideally, I would like the flag to come in or out regardless of when the lower third comes online, but I would like to keep everything within a single scene. I have also tried using a Scene Trigger event in the lower third's scene director, but again that is dependent to when the scene is executed. 

    Does this function ultimately lay within an "if this then that" type of script or something of that nature? It seems like a simple item to develop, but I may be overlooking something within my setup. I appreciate any assistance or suggestions the community might have. 



  • 2.  RE: Scripting or Visual Logic

    Posted 11-29-2019 17:17

    Let me see if I understand. You have a lower third that comes on via a scene director. At any given time you want to be able to animate a flag (chosen by operator) into the scene as well. Would this flag ever want to animate on with the scene? If not here is one way you could do it. Set up text object that isn't visible. Set it's data source as static text and allow user input. This opens a user input box where you can list your flags. Maybe by a tri-code. include a "blank" or "none".  You then add a column and enter the corresponding materials for each of the flags that correspond to the tri-code. Then, publish the quad that holds the flag. "Assign columns" allows you to assign the material to the quad based on which input you choose. You can change the operator input type to "list box, radio buttons, etc). That will set the material on the fly. You could add a second text input that allows the operator to select when the flag animates on, or doesn't animate on at all. (0,1,2) maybe. Then just a little scripting would trigger a different scene director to animate the flag on when you want. "If 'time = 0 then trigger instant animation".

     

    This should be clear as an opaque material applied to a quad. If I'm in the wrong ballpark, sorry. 


    #XPression


  • 3.  RE: Scripting or Visual Logic

    Posted 01-03-2020 23:52

    Thanks Malcolm for your feedback. I follow what you are saying, and what won't change within each flag is the material used behind the text of the flag, so I don't know if your suggestion to use a tricode would be effective for what I'm attempting to do. Your suggestion to use a second text input to select when the flag animates on or not is in line with what I'm attempting. Could you expand a little more on how you would set that up exactly?

    To add a little more context to the graphic I'm working with, I've included a few images to provide more context around what I'm attempting to do. Ultimately I would like to have the flag be able to come in with the lower third graphics or to be managed separately so that I can take it off-screen without having to take the lower third offline to do so. 


    #XPression


  • 4.  RE: Scripting or Visual Logic

    Posted 01-05-2020 04:36

    I may be down a rabbit hole but here goes. I created a quick scene with a BG, a "flag" and a text object that will work as a selector. The text object is published and so is the material for the "flag" quad. The "selector" has three choices for the operator and each of these choices have a material assigned to them. So if the operator selects "blue", then the material "Blue" is assigned to the "flag" quad. and so on. That sets the material for the flag.


    #XPression


  • 5.  RE: Scripting or Visual Logic

    Posted 01-05-2020 23:36

    Thanks Malcolm,

    I'm able to create the flag text and material as you've laid out above, where I'm stuck is how to set up the visual logic so that the when either the Red/Blue Flag is chosen in the radio button, how do I get that choice as the driver for playing my scene director specific to the flag. I suppose it would be the same set up (only in reverse) when the None radio button is chosen. The resulting action would cause the "flag offline" Scene Director to run. Currently, I have the visibility of the "Flag Grp" as the determining factor for whether the flag Scene Director plays on the transition in for the entire scene. In the end result, I want that action to act separately to the lower third in the scene, but still exist as part of the lower third scene. If anything I'm the one going down the rabbit hole :)


    #XPression


  • 6.  RE: Scripting or Visual Logic

    Posted 01-06-2020 18:26

    The way mine works, it would just apply a material to your flag. The flag would animate every time, but if you have a blank material then the flag wouldn't be visible. So, you could use the same animation for every one. Also, the operator can add more flag variations without adding any more scene elements or modifying the Animation Controllers or the Scene Director.


    #XPression


  • 7.  RE: Scripting or Visual Logic

    Posted 01-07-2020 03:25

    Thanks Malcolm. I do get what you are saying, but where my understanding in your explanation falls short is how your setup controls the flag coming in and out of the online scene. I gather that you aren't using a separate scene just for the flag, as that would only complicate things. If you are using scripting, would you mind sharing what your approach is there? I think what would be ideal for my setup would be to utilize scripting and a "GetSceneDirectorByName" method to activate the animation of the flag online, but while I've gone through a number of scripting related solutions on this forum, I haven't found one that deals with this action similarly. If there is an easier method to control the online/offline action of the flag, without having to learn the details of scripting, I'm open to that too! :)


    #XPression


  • 8.  RE: Scripting or Visual Logic

    Posted 01-07-2020 15:25

    Hey Bill, Here is what I am thinking. If you are using transition logic you could build  IN, OUT & DEFAULT scene directors. On the IN you would have an animation controller that would put the scene on line then have a pause. Hit the return key and the flag would animate on. Hit the minus key and the scene would animate out via the OUT scene director (once you set up the transition logic). If you aren't using transition logic then on your scene director have an animation that animates the scene on, then has a pause followed by the flag animating on (either by a separate animation controller on a track of the scene director or from inside the animation controller you use to animate the scene on) and then a pause, followed by the scene animating off. If the scene doesn't need a flag the operator selects none and a blank material is applied to the "flag" quad and animates on but it's not seen because a blank material is applied. So, no scripting and no visual logic needed.


    #XPression


  • 9.  RE: Scripting or Visual Logic

    Posted 01-07-2020 18:27

    Hi Malcolm, 

    I currently have the lower third scene setup to use Transition Logic to smooth out the back-to-back transitions and transitions between other scenes in the project. I included images of the Locator (Flag) Scene Director in an earlier post, which incorporated the pause you are referring to above. I think what I'm stuck on is being able to trigger that Locator Scene Director via scripting, or Visual Logic so that the locator scene can exist on its own, or within the lower third scene, and only be triggered when the script is run (via a keyboard shortcut). The shortcoming for me is my understanding of how that would be set up in the scripting tools within XPression. Ideally, a scripted solution to trigger the flag would be best, as it wouldn't need to see an additional scene in the Sequence, for a show that already has quite a lot of scenes loaded. I hope this makes sense. 


    #XPression


  • 10.  RE: Scripting or Visual Logic

    Posted 01-07-2020 18:46

    Ok, so the flag scene is totally a different scene? The operator will select which flag to add and then using a hot key combination it will put that scene on line on a different layer? That's a pretty easy script to do.


    #XPression


  • 11.  RE: Scripting or Visual Logic

    Posted 01-07-2020 19:00
    dim scene as xpScene
    dim fb as xpOutputFramebuffer
    dim scenedir as xpSceneDirector
    dim layer as integer
    
    engine.GetOutputFramebuffer(0, fb)
    for layer = 0 to 10
      if fb.GetSceneOnLayer(layer, scene) then
        if Scene.Name = "YourFlagScene" then
          if scene.GetSceneDirectorByName("YourFlagDirector", scenedir) then
            if scenedir.position >= 150 then
              scenedir.PlayRange(150, 0)
            else
              scenedir.PlayRange(0, 150)
            end if
          end if
        end if
      end if
    next

    #XPression


  • 12.  RE: Scripting or Visual Logic

    Posted 01-07-2020 19:02

    Hey Malcolm, 

    Currently, the Locator (Flag) scene exists both ways, embedded into my 2-line lower third scene, and also as it's own scene on a lower layer. I've included a screenshot of my 2-line scene...

    Now that being said, I could go either way with this, in that I would like to see the flag as part of the lower third scene, as it removes the need to have another scene in the Sequence, but if there is a scripting option that would allow me to trigger the Locator (Flag) scene without having to keep it in the Sequence, then I'm all of keeping that scene element in its own scene. Either way, I'm up for scripting a solution for this, I just have limitations around my understanding of scripting in XPression. Thanks Malcolm


    #XPression


  • 13.  RE: Scripting or Visual Logic

    Posted 01-07-2020 19:03

    this one will play your flag scene on any layer between 0 and 10 (change these numbers to expand the layers).

    Change the name of the Scene.Name to match your Flag Scene and change the GetSceneDirectorByName to the name of the scene director you want to fire. 


    #XPression


  • 14.  RE: Scripting or Visual Logic

    Posted 01-07-2020 19:10

    Thanks Malcolm - Now is that script something that should be applied directly to the object group for the flag within the 2-line lower third scene or would this only apply to the scene with the Locator (Flag)? Or, as I've seen elsewhere on the community, would this be a script to apply and associate to a key combo setup in the modified keyboard shortcuts? 


    #XPression


  • 15.  RE: Scripting or Visual Logic

    Posted 01-07-2020 19:16

    you would put this in a  key combo in the keyboard/gpi mapping section


    #XPression


  • 16.  RE: Scripting or Visual Logic

    Posted 01-07-2020 19:17

    All this script will do is play your flag scene.


    #XPression


  • 17.  RE: Scripting or Visual Logic

    Posted 01-07-2020 21:39

    Hey Malcolm - I've applied your script as a Script Event in the Keyboard/GPI Mapping section of XPression Designer. I've associated the Scene.Name with the appropriate scene name "Locator Flag", and I've also added the scene director name "Locator IN" to the script. The script compiled properly, so I created a shortcut to trigger the script, and added the locator flag to the sequence. Do you see anything here that would prevent the scene from triggering when the shortcut is activated on the keyboard? So far I haven't been able to get this flag scene to come online. I've included a screenshot below for reference:


    #XPression


  • 18.  RE: Scripting or Visual Logic

    Posted 01-07-2020 22:12

    Well, as long as you have a key sequence (like Alt F) assigned. PLUS in the script where it says if scenedir.position >= 20 this scene director will only play 20 frames. So if your scene director is longer than that you can delete the if scene dir.position line and the line below it, the else line and change the next line to scenedir.Play. then remove the end if below that line. That checks where the scene director play head is and either plays it forward or backward depending on where it is. I use it as part of a match game that flips over tiles. Try that first.


    #XPression


  • 19.  RE: Scripting or Visual Logic

    Posted 01-07-2020 23:20

    Hey Malcolm - Thanks again for the explanation. I think what was preventing the script from executing was the visual logic I had set up for the flag scene director. The visual logic was set to look at the visibility of the Group which the flag was within, and then another visual logic setup would look at whether the "Locator Text" object was empty and based on whether it returned a 0 or 1 it would result in turning the visibility off for the parent of that text object. With both running, the script wouldn't respond as expected. Once the visual logic controlling the group was disabled, everything appears to be working fine. Thanks for the assistance!


    #XPression


  • 20.  RE: Scripting or Visual Logic

    Posted 01-08-2020 04:12

    Happy to help Bill. I just hope I didn't take you in a direction opposite of what you really wanted to do.


    #XPression


  • 21.  RE: Scripting or Visual Logic

    Posted 01-08-2020 04:31

    Hey Malcolm - Not to worry... If anything my explanation of the issue was the likely culprit to going in a different direction! I appreciate your help, and it's great to now have another tool in my XPression arsenal to apply to introduce scene directors into online scenes. Everything worked out great, and to have an issue that's halted my progress on this project for the past couple of months, now out of the way! All the best :)


    #XPression


  • 22.  RE: Scripting or Visual Logic

    Posted 01-08-2020 04:42

    Hey Malcolm - One more thing... While I have your attention. If I wanted to modify the script you provided so that the flag Scene Director would execute it's (scenedir.PlayRange(150, 0)) command when the parent scene is taken offline, what would you add into the script to make that action take place? I suppose this could be achieved with some Visual Logic as well...  


    #XPression


  • 23.  RE: Scripting or Visual Logic

    Posted 01-08-2020 04:52

    Well, you could put a "trigger scene director" on the scene director that you use to take the scene off. Right click on the scene director and you can see a trigger. You go into properties and pick the scene director you want to trigger. It has to be in the scene that is on line or it won't trigger. You can drag this trigger left or right and it will trigger your flag scene director. But it would probably be easier just to do it in the out scene animation controller. How's that for a circular answer?


    #XPression


  • 24.  RE: Scripting or Visual Logic

    Posted 01-08-2020 05:37

    That does make sense Malcolm... And it works nicely with the out transition Scene Director!

    Now here's another thought, going in a different direction. Say that I wanted to have the Locator (flag) scene in the Sequence, and I have it set up to be triggered by the keyboard shortcut. Is there a method to trigger the scene without first taking the Locator scene online in the Sequence? When I was playing around with triggering the Locator scene separately from the lower third scene, earlier, I found that the Locator scene wouldn't allow the keyboard shortcut script to activate unless the Locator scene was online first. I think what I'm looking at here would require the script not only trigger the Scene Director but to also trigger the Locator scene online or offline, depending on the operator's needs for the locator. 


    #XPression


  • 25.  RE: Scripting or Visual Logic

    Posted 01-08-2020 06:10

    If I understand what you are saying then yes you could set it up. If in your scene director for the locator you put a pause before anything really happens then it is on line, but hasn't animated anything yet. So, when you trigger the scene, it could possibly read a trigger as just an "enter" command and then the scene would play out. You would want to modify the script from sd.playrange to sd.play. At least I think that's what you want to do.


    #XPression


  • 26.  RE: Scripting or Visual Logic

    Posted 01-08-2020 06:26

    Is this what you were thinking:

    dim scene as xpScene
    dim fb as xpOutputFramebuffer
    dim scenedir as xpSceneDirector
    dim layer as integer

    engine.GetOutputFramebuffer(0, fb)
    for layer = -1 to -1
    if fb.GetSceneOnLayer(layer, scene) then
    if Scene.Name = "Locator Flag" then
    scenedir.Play
    end if
    end if
    next

    I suspect this is part of the solution, but I also wonder if there is a method missing which would first call the Scene to change its state from having no state to being online. I've set up the "Locator Flag" scene so that the Scene Director for the locator transition in hits a pause event on it's first frame. Now I just need to insert a command in the script which will change the scene state. What are your thoughts on that? 


    #XPression


  • 27.  RE: Scripting or Visual Logic

    Posted 01-08-2020 17:33

    reach out to me here: malcolm.thorpe@utahjazz.com


    #XPression