Page 1 of 1

[Solved] Macros: refresh the cache when buttons are used?

PostPosted: Fri Apr 12, 2024 9:18 am
by BartReynaard
Sorry for the title I didn't find a better phrase.

however here is the problem:

In Fusion, I have made some macro and saved as Edit > Title, that is using several pre-configured text blocks.
I mean: text-block with their field with written phrases in them.

Each field contains a phrase in a language.
I do use 4 languages: English, Dutch, French, Italian.

The goal: I swith these phrase (these languages) just by clicking on a button in the Edit Page

how I do it? All these text-blocks go to a MultiMerge block.
With "Edit Controls" I created buttons, and the "Blend" control that receive the signal from each Text-Block, is controlled by the button.

Here below the code

Code: Select all
ENG
iif(Data.Language==0,1,0)
DUT
iif(Data.Language==1,1,0)
FRE
iif(Data.Language==2,1,0)
ITA
iif(Data.Language==3,1,0)


having said that: everything works fine. I do use this method successfully.
BUT ... yes there is a "but" ... once the Macro -Title I created is imported into the EDIT PAGE, if I click on any button BEFORE the cache is completed, I get the change as i want.

BUT if I switch it AFTER the cache is completed, i don't get it. I need to delete the cache, click on any button I need, then let the cache do its job.

Nwo the question is: how can i delete the cache when I just click on the button in order to get the change immediately? It seems indeed that DaVinci doesn't intercept any change when I click the button to switch forma text to another.

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 8:32 am
by BartReynaard
No suggestions?

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 11:00 am
by roger.magnusson
I think you need to change an input value in order for Fusion to know something has changed. Maybe use a dropdown/MultiButtonControl to select the language instead?

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 2:33 pm
by BartReynaard
roger.magnusson wrote:I think you need to change an input value in order for Fusion to know something has changed. Maybe use a dropdown/MultiButtonControl to select the language instead?

but a Button isn't an input value that when I click it it changes?

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 2:38 pm
by Sander de Regt
I would expect it to react to what you're doing, definitely.
Without seeing the exact way you set it up it's hard to tell, but changing a value should trigger a refresh in my opinion.

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 2:45 pm
by BartReynaard
Sander de Regt wrote:I would expect it to react to what you're doing, definitely.
Without seeing the exact way you set it up it's hard to tell, but changing a value should trigger a refresh in my opinion.


in this moment, while I was experimenting what you suggested, I found that in Edit Controls:

if I setup the button as "Passive", it just switch.
if I set them up as "Animatable" when i switch, it removes the cache and I see the changes, then it re-caches of course the block.

Can you confirm this behaviour?

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 2:54 pm
by Sander de Regt
That makes a lot of sense. I am not sure where I read this - I should bookmark stuff like that - but I think 'passive' edit controls don't create undo buffer events (or whatever they're called) so it would definitely explain the behavior you're seeing.

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 3:15 pm
by roger.magnusson
Ah, yes that's right. I thought maybe that attribute only existed in Fuse plugins which is what I'm more used to. And yes, it should work for standard buttons as well.

When coding, the "INP_Passive" attribute is false by default. When set to true it lets Fusion know that the value of the input doesn't affect the rendered result which is why it won't clear the cache.

Re: Macros: how to refresh the cache when buttons are used?

PostPosted: Sat Apr 13, 2024 3:19 pm
by BartReynaard
Thank you to both. now I finally understood what these 2 settings serve "Animatable" and "Passive".
Great :-)

thank you to all of you guys and have a great week-end