PDA

View Full Version : Access functions in different rollouts


DJ_
03-17-2005, 05:50 PM
I am having some real trubbles with my script. I'm scripting a modifier, this modifier has two different rollouts, let's just call them 'r1' and 'r2'. Both of them has variables (that are stored within the .max file), UI objects (such as buttons and spinners), functions and everything that a good rollout needs. My big problems are:

1- I need both the rollouts to interact with eachother. I need buttons in the 'r1' to call functions in the 'r2' and also need functions in the 'r2' to access functions and/or variables in the 'r1'. if you are going to tell me "just make the function/variable a global one", please specify where and how, becouse I've tried everywhere and just didn't get it to work.

2- Is there a way to call a function that is further down in my code? I have seen it working in a macroscript (eg. the script for the "Parameter Editor") where they first declare the functions name as a normal variable, call it several times further down in the code and then they write the actual function. It seems to work well for macroscripts but I can't get it to work with my "scripted plugin modifier".

DJ_
03-18-2005, 03:44 PM
Ok.... continuing my post...

Now i know how to access a function in my rollout 'r1' from 'r2'. I use this code:

myTarget = modpanel.getcurrentObject()
myTarget.myRollout.myFunction

I haven't tested if it works the other way as well, I mean, calling a function in 'r2' from 'r1' but I supose/hope it works too.

My problem now is that doing it this way, even thow the function is in 'r1', as it was called from 'r2', it is processed as it was in 'r2', so it doesn't recognise the variables I have in my 'r1'.

When I say "variables I have in my 'r1'" I mean the variables declared inside:

parameters main rollout:r1
(
my variables....
)

Those are global inside my rollout 'r1' and are saved within the .max file, exactly what I need, but I donīt know how to make them global for my entire modifier.

Ohh... help!?

CGTalk Moderation
03-18-2005, 03:44 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.