Notifications
Clear all

[Closed] Saving scripted plugin variables

Hi,
I’m creating a scripted plugin and I have a few local variables like arrays and nodes which are not stored in parameters blocks. Is there a way to save this data, somehow bake it to .max file? How to deal with saving and loading files with scripted plugins (modifier in my case) with lots of data outside parameter blocks?

4 Replies

the right solution is to store data in parameter blocks (plugin, modifier, ca, etc.)…

if it’s not possible any reason:

convert to string …

save as a persistent global

save as an app data of any involved in the pipeline node

String doesnt sound like the best idea. Persistent global? I can’t make a global inside my scripted modifier, when I create one then each object with the modifier applied has the same, global variable, that’s not right in my case.

Could you take a look on this schema and tell if it’s possible to implement somehow? This is why I can’t hold my node in the parameter block, circular dependency error.

that’s a different story. you can just store a NodeMonitor or NodeTransformMonitor objects as a MaxObject value.
if you want to do it using SDK you can also make your own class.
you can find an example (NodeTransformMonitor) in the Max SDK.

NodeTransformMonitor looks promising, thanks for the advice, but maybe I will explain my problem more detailed. The circle plugin (made in c++) modifies the square’s modifier parameters with my

UpdateParams()

function, this modifier has also the references to the triangles nodes. I want the triangles nodes to have modifiers with a float parameter and whenever user modify it I want the circle plugin to call the

UpdateParams()

function.

So my idea was: publish a function in circle plugin like

circleOps.UpdateParams circlePluginNode triangleParameter

then make a scripted modifier for the triangles with parameter

circlePluginNode type:#node

, pointing the circle plugin, add a simple spinner and call

on spinner changed val do
(
	circleOps.UpdateParams circlePluginNode val
)

How would you do this? Is it understandable?