Announcement

Collapse
No announcement yet.

Run Artist script from Trio

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Run Artist script from Trio

    Hi

    I am new to Artist and Vizrt scripting and have some challenges – hope you can help

    I have a Master scene and a couple of leaf scenes:
    • In one of the leaf scenes I have Script – the script plugin is placed on the topmost container
    • I run/call the script by an action keyframe in the leaf scene’s director
    This work fine when I am in Artist. But when I call the scene from Trio, the script is not activated.

    Can anyone tell what I am missing / doing wrong – and guide me to make this work?

    Thanks in advance
    Jogvan Olsen





    My Script
    -----

    dim keyend, keystart as keyframe
    dim dir1 as director
    dim width_titel, width_navn, width_max as double
    dim width_max_int,r_offset,w, h as integer

    function getW(con as string) as double
    getW = scene.FindContainer(con).GetTransformedBoundingBoxDimensions().x
    end function


    scene.findContainer("TEXT_GRP").GetScreenSizeOrtho(w,h)
    scene.findContainer("TEXT_GRP").SetScreenPositionOrtho(720-(w*-1),58)

    dir1 = Stage.FindDirector("Default")
    keyend = dir1.FindKeyframe("end_pos")
    keystart = dir1.FindKeyframe("start_pos")
    keyend.XyzValue.x = 294
    keystart.XyzValue.x = 360+w+20
    width_titel = getW("TITEL")
    width_navn = getW("NAVN")

    if (width_titel >= width_navn) then
    width_max = width_titel
    else
    width_max = width_navn
    end if
    width_max_int = CInt(width_max)

    scene.findContainer("TEXT_GRP").center.x = width_max*-1

    'hoejre + venstre marging til baggrund
    r_offset = 80

    'saet baggrund streger
    scene.findContainer("BGD_NAVN").SetScreenSizeOrtho(width_max_int+r_offset,32)
    scene.findContainer("BGD_TITEL").SetScreenSizeOrtho(width_max_int+r_offset,30)
    scene.findContainer("ROED_STREG").SetScreenSizeOrtho(width_max_int+r_offset,3)
    -------

    My Action keyframe to run the script contain this command:
    THIS_SCENE*TREE*$object*SCRIPT*PLUGIN COMPILE
    ---

    We are using:

    Artist Version: 3.6.2
    Trio version: 2.12.0


  • #2
    I have ran into the same issue before, It was on a prev version of artist tho, My script worked in artist but it did not get triggered in trio.. The fix was weird but it worked... I just made sure the Animation director in the callup scene was named "Default". That fixed my issue and it worked then...
    Alternatively if that did not fix your problem I would suggest putting a script in the master scene to goes into the toggle plugin sub directors (to get to the callup scene object) and then reaches inside the merged container to trigger the script "this.mergedContainer.FirstChildContainer.Script.....invoke".

    It's an issue with how a callup scene is dealt with then it is merging with a master scene once pulled in by the toggle plugin.

    When i get a chance to test this I will give feedback here

    Comment


    • #3
      thanks, I'm back on work on Monday - and then I'll try your solution

      Comment


      • #4
        Hi,

        I have tried your solution but can’t get it to work - probably because I'm pretty inexperienced with Vizrt.

        What I am trying to achieve whit my script is to create an upper-right graphic with name and title in two lines:
        • Name and title have a transparent background
          - the background has a gradient
        • The upper-right is pushed in from right and fade out
          - I use the length of the longest line to calculate the x-position
        • The longest line ends at the right site title safe line
        • The longest line determines start position of the shortest line and the length of the background graphic
          (see the two attached images)

        Both text and background are placed in a leaf-scene. My script is also placed in the leaf-scene.

        The script works and does what I want when I am in Artist – but I can’t trigger the script from Trio. And I can’t figure out how to place the script in my Master scene, when the text (name and title) I use for calculations is place in a leaf scene.

        Can anyone guide me further in triggering one leaf scene script from Trio, or how I can move my script to the master scene, and still use the length of the text in the leaf scene for calculations in the script.

        Or can I get the same result without a script? How?



        Regards

        Jogvan Olsen
        Attached Files

        Comment


        • #5
          Jogvan Olsen
          Register a pushbutton using this
          Code:
          sub OnInitParameters()
          RegisterPushButton("action", "Action", 1)
          end sub
          then you can execute your function using this

          Code:
          sub OnExecAction(buttonId as Integer)
          call your function here getW(con as string) as double --- I'm not sure of the correct syntax here
          end sub
          add your button to the stage, you create a director and drag the container to the director, if you don't have a director because nothing is animating, create a dummy animation, right click on the container now on the stage and you should see the script and the button on a submenu, the button will get added 2 times on the director delete one of the instances, and set your option on the panel to the right once you select the keyframe for the button. now every time this director runs your button will get triggered when the play-head hits it and your script will run.

          I hope this is of some help to you.
          PS I am writing this from memory, please if I have anything wrong someone correct me.
          Last edited by matzunaga; 09-07-2018, 06:08 AM.

          Comment


          • #6
            Thank you,

            The script is now called, and it works perfect as long as long as i run the scene as a standalone scene in Trio.

            BUT when i make the scene to a leaf scene of a master scene, I get a new challange:
            - the script will not read/use the tekst entered in Trio (or sendt form ENPS/Mozart) for calculations.

            Comment


            • #7
              Jogvan Olsen I know more scripting, you can add a registerparameter to a text and then call it onparameterchanged and call a function every time the text changes in this case everytime someone types in the text field in trio.

              Sorry I don't remember the correct syntax

              But the idea is to say, keep track of this text and every time someone types a letter call the script I need.

              Have you tried using the Text BG plugin, it might help you get what you are after
              https://docs.vizrt.com/viz-artist-gu...s_text_bg.html

              Hope this helps, good luck

              Comment

              Working...
              X