Graphics

 View Only
  • 1.  Change Scene name with text layer

    Posted 10-16-2017 20:50
    Hello - is it possible to change the team name with a script or visual logic? I have individual scenes for each game occurring around the league and want to use the data coming into the scene to rename it based on the teams playing.

    I've tried different variations of

    dim home, away as xpTextObject

    self.GetObjectByName ("HOME", home)
    self.GetObjectByName ("AWAY", away)

    self.name = home.text + "@" + away.text


  • 2.  RE: Change Scene name with text layer

    Posted 11-07-2017 23:18
    Hi,

    I had a moment and was perusing posts and noticed nobody has answered your question, and I think it's because it's very unclear.

    Are you trying to change the text displayed? Or change the scene name (as your post title suggests), or change the name of an object?

    If you're trying to set the name of the scene, your issue could be that you're trying to set it on the copy of the scene, and not the "actual" scene.

    So, if I use this as the on-set-text script for Text1 (and I have another field Text2):

    dim real_scene as XpScene
    dim text2 as XpTextObject ' running on Text1 on-set-text, so we already have the value

    if Engine.GetSceneByName(Scene.Name, real_scene, False) then
    if real_scene.GetObjectByName("Text2", text2) then
    real_scene.Name = Text & "@" & text2.Text
    else
    Engine.DebugMessage("Could not get Text2 object in " & Scene.Name, MessageType.mt_Error)
    end if
    else
    Engine.DebugMessage("Could not get scene " & Scene.Name, MessageType.mt_Error)
    end if


    Note that the important thing here is you are probably running a copy of the scene from the sequencer; this script looks up the actual non-copy scene (note the "False" parameter in GetSceneByName) and renames it. The Xpression interface will NOT magically update, but if you, for example, toggle between Layout and Sequencer, you will see that it has indeed changed the name of the scene.

    However, all that said and done, this is probably NOT what you actually want to do... if you have five instances of this scene in the sequencer, for example, it will not make five versions, all named based on the match-up selected, it changes the one and only scene to have a different name. You might have been thinking you want to change the name of the copy of the scene that the sequencer put online or is previewing, but that scene is actually not "saved" anywhere, so in Xpression's memory, you will have renamed the scene - but it will not ever be visible to you anywhere, and it will not be persistent.
    #XPression