Background sizing with multiple text containers

juanb

New member
Hi all !
I'm trying to define the right banner size to support my text.
Text size is defined by 3-4 text containers that follow each other thanks to autofollows. Some fields can be empty, shifting other fields accordingly.
To date, I use a script to determine the size. The problem is that I have plugins (like autofollow) that influence my geometry. The script calculates the size first, then the autofollow plugin kicks in, which distorts the size calculation.
Is it possible to ask VizArtist to execute the script procedure after the plugins have been executed?
Note that I have to transfer this text size to several containers in the scene that make up the background.
Thank you in advance for your expert advice.

------------------------------------------------------------------------------------------------------------

Bonjour à tous !
Je cherche à définir la bonne taille de bandeau qui supporte mon texte.
La taille du texte est définie par 3-4 conteneurs de texte qui se suivent grace à des autofollow. Certains champs peuvent être vides, ce qui décale les autres champs en fonction.
A ce jour, j'utilise un script afin de déterminer la taille. Le problème vient du fait que j'ai des plugin (comme autofollow) qui influent sur ma geometrie. Le script calcule en premier la taille puis le plugin autofollow entre en action, ce qui fausse le calcul de la taille.
Est-il possible de demander à VizArtist d'exécuter la procédure du script après l'exécution des plugins ?
A noter, je dois reporter cette taille de texte sur plusieurs conteneurs de la scène composant le fond.
Merci d'avance pour vos conseils éclairés.
 
Hi Juanb,

Whenever I need to scale backgrounds with text elements I use Text-BG placed on the noggi and I set TextBG to reference the parent container of all the fonts and logos that are chained together with auto-follow. The bg should scale according.

Here is a small vizscript example I just tested, you can paste this script on the parent container of all the text/logos with autofollow. then drag the background noggi container into the BG container parameter on the script and it should reposition and scale to fit. Its just to illustrate, TextBG is there and has padding ect. *also attached a small scene demonstrating the use of TextBG on multiple child containers connected with autofollow. Funfact if you wanted to keep all this nicely centered you throw a Justifier plugin on the parent container and lock x , set desired location. change the length by changing the data and see the behaviour.

sub OnInitParameters()

RegisterParameterContainer("BG","BG")
end sub

sub OnExecPerField()

Dim size as vertex = this.GetBoundingBoxDimensions()

GetParameterContainer("BG").position.x = this.position.x
GetParameterContainer("BG").Geometry.setParameterDouble("width",size.x)
GetParameterContainer("BG").Geometry.setParameterDouble("height",size.y)


end sub
 
Hello Novacane,
First of all, thank you for your reply. The TextBG plugin works very well with the Justifier plugin.
I've also seen the script, which is perfectly functional, but I'm not very happy with the OnExecPerField() procedure, which is triggered 50 times a second ! I think that's a bit much for scaling backgrounds with text elements! This is, of course, a personal opinion.
So, to take things a little further, do you know if the TextBG plugin is coded on an OnExecPerField() procedure? Is the same true of the Justifier, AutoFollow and Maxsize plugins?
Good day to you all, and thank you in advance for your enlightened advice!

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Bonjour Novacane,
Tout d'abord merci pour votre réponse. Le plugin TextBG fonctionne très bien avec le plugin Justifier.
Vu aussi le script, tout à fait fonctionnel, cependant, la procédure OnExecPerField() ne me plait pas beaucoup car elle se déclenche 50 fois par secondes ! Je trouve que pour mettre à l'échelle des arrière-plans avec des éléments textuels, c'est un peu beaucoup ! C'est bien évidemment un avis personnel.
Du coup, pour aller plus loin dans la réflexion, savez-vous si le plugin TextBG est codé sur une procédure OnExecPerField() ? En est-il de même pour les plugin Justifier, AutoFollow, Maxsize ?
Bonne journée à tous et merci d'avance pour vos conseils éclairés !
 
Hi Juanb,

So I will not be able to 100% confirm without impunity but would go ahead and suggest that Justifier, AutoFollow ,Maxsize plugins do in-fact use the OnExecPerField event or something similar to it as it needs to scale/position/follow and match the Font or reference container EVERY frame. Example... A logo is following a noggi using autofollow. If this noggi width or scale is animated the logo will stil follow and react to the noggi width/scale/postition every frame during animation. Same in certain textFX animations.

The justification here is that You just need to RESPECT the OnExecPerField(). Use it wisely. For basic actions that do not consume lots of resources. I am not using foreach loops or intense processing in that event. We are only giving a basic instruction... Alter position or scale based on a reference parameter and load a single vertex variable before doing so. I have tested the limits of our viz engines and they are capable of handling many OnExecPerField scripts it just depends on what you use them for.

As a fellow programming enthusiast i do respect the concern you have regarding optimization of the script event. Here is an altered script that uses the same actions but ties the event to a button on the script once compiled... Now you can animate the button to "TRIGGER" scale Update just before graphic becomes visible. That way you are updating the noggi size to the text at the beginning once... provided there is not change after... for alpha in or shader animations this will work fine regardless of when you update, as long as it is before the graphic is visible. If you are triggering a noggi size or container position then make sure to do so after it has changed state as you are not keeping track now every frame. You could also add multiple update button triggers on the stage at select times you want it to update. You have some options :)

sub OnInitParameters()

RegisterParameterContainer("BG","BG")
RegisterPushButton("Set","Set",1)
end sub


sub OnExecAction(buttonId As Integer)
Dim size as vertex = this.GetBoundingBoxDimensions()

GetParameterContainer("BG").position.x = this.position.x
GetParameterContainer("BG").Geometry.setParameterDouble("width",size.x)
GetParameterContainer("BG").Geometry.setParameterDouble("height",size.y)
end sub


You could also use OnExecPerField() and setup a counter that triggers the script every 50th time. that way you are reducing the event trigger from 50 per sec to 1. I guess you can deal with this in a lot of ways.

Cheers
 
Last edited:
Hello Novacan89,
Thank you for your reply and the proposed solutions!
I like the counter idea !

Many thanks for your answers.
Have a nice day!
Cheers

-------------------------------------------------------------------------------------------------------------------------------------------------

Bonjour Novacan89,
Merci pour votre réponse et les solutions proposées !
J'aime beaucoup l'idée du compteur.

Un grand merci pour vos réponses.
Bonne journée
 
Back
Top