Graphics

 View Only
  • 1.  Xpression: set script on object through scripting?

    Posted 02-24-2024 20:18

    Hello, I have a scene where all the content is generated dynamically by a script that runs in OnPrepare. But many of the text object copies need to trigger something on a datalinq change. I would normally do this in OnSetText. Is there a way to assign a script (like OnSetText) from a script, or copy it from an existing object? I can put scripting in OnRender, but it's a lot of objects and that creates a lot of pressure on the system to handle it all every frame (changing every frame is not necessary). 

    To be more specific:

    1. OnPrepare creates many copies of a hierarchy of objects (between 10-100 copies).
    2. One of those objects in each copy of the group is a textfield tied to a datalinq. When the datalinq changes, the OnSetText script should apply a material to a quad based on the new value. I can't control the DL feed format, so I can't specify material names here, and I can't name my materials after the returned value because the same values will be used for different sets of things...hence needing some basic logic in the script.
    3. I can do all of this in OnRender, but updating materials on up to 100 objects per frame causes performance problems, actually it starts affecting performance over about 20.
    4. The general idea is to maintain flexibility by dynamically creating the objects when the scene is prepared based on a prototype, and not pre-creating all 100+ hierarchies in the scene, which would be a nightmare to maintain if changes are needed. It all woks quite well except for this one script problem.

    Thanks.



    ------------------------------
    Ben Stahl
    ------------------------------


  • 2.  RE: Xpression: set script on object through scripting?

    Posted 02-26-2024 05:19

    Perhaps put the script on a scene director with a loop for how often you need it to update?



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Xpression: set script on object through scripting?

    Posted 03-07-2024 15:09

    Thanks Simon, I am doing this...had to make multiple duplicate scripts to spread the work out over multiple frames. It works, but a bit clunky.

    Still would like a scripting call to assign a script (as string) to an object!



    ------------------------------
    Ben Stahl
    ------------------------------