Graphics

 View Only
Expand all | Collapse all

Rascular's Automation Gateway / XPression "“ text scripting issue

Remo Marti

Remo Marti05-22-2015 12:28

  • 1.  Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 05:49

    Hello there

    scripts are not working the way I assumed with text delivered to XPression from Rascular's Automation Gateway (RAG). I've tried several methods to make it work, but it seems to me that the text from RAG is passed on to XPression differently from how it's usually done within XPression.

    What I'm trying to do:

    Scene 2401 (layer 9 on framebuffer 1) has a textobject "Box0" which receives the text from RAG. It also has a script that triggers another scene in the Sequencer (scene 2404). Until here it is working fine.

    Scene 2404 (layer 10 on framebuffer 1) has the following script on the Scene Layer:



    dim box0 as xptextobject

    dim wb as xpscene

    dim text1 as xptextobject

    engine.getscenebyname("2401",wb)

    wb.getobjectbyname("Box0", box0)

    self.getobjectbyname("TEXT",text1)

    text1.text = box0.text

    dim titel as xptextobject

    dim utitel as xptextobject

    dim UTbgd as xpbaseobject

    dim stringsplitter as string

    self.getobjectbyname("TITEL", titel)

    self.getobjectbyname("UTITEL", utitel)

    self.getobjectbyname("TXT-BGD2", UTbgd)

    stringsplitter = "*"

    If text1.text.Contains(stringsplitter) Then

    titel.text = text1.text.Substring(0,text1.text.IndexOf(stringsplitter)).Trim()

    utitel.text = Right(text1.text, text1.text.length-1-text1.text.IndexOf(stringsplitter))

    utitel.visible = true

    UTbgd.visible = true

    else

    titel.text = text1.text

    utitel.visible = false

    UTbgd.visible = false

    End If

    Engine.ClearFrameBufferLayer(0,9)



    When triggering scene 2401 with the Box0 text published in the Sequencer, it passes on the text to 2404 the right way. But when done through RAG it's not working. Is there another solution to this problem?



  • 2.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 06:38
    To do that, replace in your code your .getscenebyname with a getoutputframebuffer, then .getsceneonlayer 9.

    It doesn't work because the scene online on layer 9 with RAG is probably a copy of your template 2401.

    #XPression


  • 3.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 07:28

    Hi Vincent

    thank you for the fast reply. Unfortunatly, I'm not getting it to work. The start of the script looks like this now:



    dim box0 as xptextobject

    dim wb as xpscene

    dim text1 as xptextobject

    dim fb as xpoutputframebuffer

    engine.getoutputframbuffer(0, fb)

    fb.getsceneonlayer(9, wb)

    wb.getobjectbyname("Box0", box0)

    self.getobjectbyname("TEXT",text1)

    text1.text = box0.text


    ...



    Nothing happens and the script isn't running to the end so it must be syntax error. But I just can't figure out what is wrong. Could you please help me out?


    #XPression


  • 4.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 07:33
    You missed a "e" in getoutpuframebuffer...

    #XPression


  • 5.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 07:42
    Thanks, now it works. Strange it did compile without errors...

    #XPression


  • 6.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 12:37

    Dear Vincent

    The script works within XPression, but we just tested it with RAG and it still doesn't pass along the text, even with this new method. Last week I talked to Roddy from Rascular and he sent me the code that RAG executes when setting the text in XPression:



    if (frameBuf.GetSceneOnLayer(l, &scene)) // fetch the scene

    {

    if (scene.ObjectCount >= box) // check box number is in range

    {

    IxpBaseObjectDisp base;

    UTF8String name = "Box" + IntToStr(box);

    if (scene.GetObjectByName(COM_STR(name), &base) || // get by 'name', else by index.

    scene.GetObject(box, &base))

    {

    IxpTextObjectDisp t;

    base->QueryInterface(&t);

    if (t)

    t.set_TextWithTags(COM_STR(layer.textBoxes[Box]));

    }

    }


    I hope there is a solution to this matter.


    #XPression


  • 7.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-13-2015 13:31
    I'm not clear on where this script is located.. Is it in an OnSetText for an object, or OnOnline, etc?

    #XPression


  • 8.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-14-2015 12:11
    Hi Brian, do you mean the script from Rascular or mine? I can only answer where my script is located: OnOnline.

    #XPression


  • 9.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-14-2015 13:44
    I think what is happening is that Rascular probably updates the Text after the scene is already online.. Therefore your OnOnline script has already been run before rascular updates the text in the scene.. We can see this by the code you posted from Rascular where they call GetSceneOnLayer followed by the SetTextWithTags call. This means the scene is already online (or else the GetSceneOnLayer would not return anything).

    You might need to re-think your approach, and maybe change the scripting to use OnSetText instead, so that anytime the text in the RAG scene is updated it could push the info to your other scene.

    #XPression


  • 10.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-15-2015 11:02

    Now I tried two different approaches:

    1st: Script Event in Scene Director on second frame. Did work within XPression, but not with RAG.

    2nd: I split up the script on the two textobjects the following way (OnSetText):

    Script on TITEL:


    dim wb as xpscene

    dim text1 as xptextobject

    dim fb as xpoutputframebuffer

    dim titel as xptextobject

    dim utitel as xptextobject

    dim UTbgd as xpbaseobject

    dim stringsplitter as string

    engine.getoutputframebuffer(0, fb)

    fb.getsceneonlayer(9, wb)

    wb.getobjectbyname("Box0", text1)

    stringsplitter = "*"

    If text1.text.Contains(stringsplitter) Then

    text = text1.text.Substring(0,text1.text.IndexOf(stringsplitter)).Trim()

    else

    text = text1.text

    End If

    Script on UTITEL (Subtitle):

    dim wb as xpscene

    dim text1 as xptextobject

    dim fb as xpoutputframebuffer

    dim UTbgd as xpbaseobject

    dim stringsplitter as string

    engine.getoutputframebuffer(0, fb)

    fb.getsceneonlayer(9, wb)

    wb.getobjectbyname("Box0", text1)

    scene.getobjectbyname("TXT-BGD2", UTbgd)

    stringsplitter = "*"

    If text1.text.Contains(stringsplitter) Then

    self.text = Right(text1.text, text1.text.length-1-text1.text.IndexOf(stringsplitter))

    self.visible = true

    UTbgd.visible = true

    else

    self.visible = false

    UTbgd.visible = false

    End If



    In this case, it's neither workin in XPression nor with RAG. Is there another approach?


    #XPression


  • 11.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-15-2015 20:34
    There might be more problems than this, but you should not be calling `self.text = "something"` when inside an OnSetText script. Instead you should just write `text = "something"`.. Otherwise as soon as the OnSetText script finishes it will just overwrite what you set. The OnSetText script allows you to modify the `Text` paramater passed into the script and will set that upon exiting.. If you want to modify it yourself you need to set `handled=true`.

    #XPression


  • 12.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-22-2015 12:26

    OK, now I've got it to work with OnSetText (I didn't know that the textobject had to be published to work with scripts). But it still only works within XPression and won't set the text from RAG. I don't understand how to use handled=true. Here are the two scripts on the two textobjects:

    TITEL


    dim wb as xpscene

    dim text1 as xptextobject

    dim fb as xpoutputframebuffer

    dim stringsplitter as string

    engine.getoutputframebuffer(0, fb)

    fb.getsceneonlayer(9, wb)

    wb.getobjectbyname("Box0", text1)

    stringsplitter = "*"

    If text1.text.Contains(stringsplitter) Then

    text = text1.text.Substring(0,text1.text.IndexOf(stringsplitter)).Trim()

    else

    text = text1.text

    End If

    UTITEL:

    dim wb as xpscene

    dim text1 as xptextobject

    dim fb as xpoutputframebuffer

    dim UTbgd as xpbaseobject

    dim stringsplitter as string

    engine.getoutputframebuffer(0, fb)

    fb.getsceneonlayer(9, wb)

    wb.getobjectbyname("Box0", text1)

    scene.getobjectbyname("TXT-BGD2", UTbgd)

    stringsplitter = "*"

    If text1.text.Contains(stringsplitter) Then

    text = Right(text1.text, text1.text.length-1-text1.text.IndexOf(stringsplitter))

    self.visible = true

    UTbgd.visible = true

    else

    self.visible = false

    UTbgd.visible = false

    End If

    #XPression


  • 13.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-22-2015 12:28
    Is this issue not to solve?

    #XPression


  • 14.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-22-2015 14:37
    The text object does not need to be published for OnSetText to work. Anytime the text object has it's text changed, either from Datalinq or from an API appliction the OnSetText script will run.

    I think you will need to provide a link to the project. It is still not clear to me what you are trying to do. I see both scripts are looking at a Scene on Layer 9. Are either of these two scenes on layer 9, or there is a third scene on layer 9 which you are trying to pull data from?

    #XPression


  • 15.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-22-2015 15:01
    I sent you the Project in an Email. Interestingly, in my project the scripts only work when the texts are published. I just tested it again...

    #XPression


  • 16.  RE: Rascular's Automation Gateway / XPression "“ text scripting issue

    Posted 05-22-2015 15:04
    Thanks we will take a look.

    To clarify, the OnSetText script will only run when the text is changed, i.e. from datalinq, API, or widgets. I suspect you are simply setting the scene online from the sequencer and not actually changing the text in any way. In that case as you describe it will only run when the text is published because the text gets changed to the value of the published data you put into the sequencer as soon as you take it to air. If you link the text to a TextListWidget and unpublish it, you should see the script run anytime you change the widget for example.

    #XPression