View Full Version : tricky expression question.
MegaManZZ 12-01-2009, 12:40 PM what i need to do is run an expression only when the current camera being viewed with isn't being moved by the mouse. so to be very basic and specific i want to run the expression only when the "keyboard key 'alt' and any mouse clicks" are NOT being pressed. there might be other ways to do this (and id be happy if you share your knowledge), but at the moment if i can get the expression runs only when the alt key is not being pressed would be sufficient enough.
thanks
|
|
lwrath
12-01-2009, 06:05 PM
I would look into a scriptJob to grab which panel you have focus on and monitor that modelEditor's translation/rotation upon which if those attr's change, to turn your expression Node State to waiting normal or something... then when you stop moving the camera it will change the nodeState back to normal...
however if you change the current time there's a chance that expression will calculate for everything you did regardless of your camera's orientation.
MegaManZZ
12-02-2009, 12:36 AM
to make things easier. What i need done will only be applied to one camera, which might make things easier. Reading Iwrath's reply made me realize that i kinda misled that in fact the expression only runs on one camera. Besides that, I still don't know where to start? Is it possible to check if the previous camera position equals to the current camera position? and if so, then go ahead and run the script?. if this is possible can someone please maybe show me some code that would give me a running start? not sure how to store previous position value in expression editor.. Or maybe someone has a more efficient solution?
As well, When you are moving a camera in first person i notice that the attributes don't chage till you have completed the move and released the mouse button.. is this going to cause issues?
lwrath
12-03-2009, 08:03 PM
What i need done will only be applied to one camera, which might make things easier. Reading Iwrath's reply made me realize that i kinda misled that in fact the expression only runs on one camera.
Am I to understand you only want this expression to NOT calculate while you are moving a specific camera while looking through said camera? But if you are looking though any other camera it's ok for this expression to run? If so, just add an If statement to make sure your `modelEditor -q -cam $activeEditor` == $yourCamera in order to disable your expression.
Is it possible to check if the previous camera position equals to the current camera position? and if so, then go ahead and run the script?
scriptJob -ac "persp.t" "print \"It's peanut butter jelly time!\\n\";";
As well, When you are moving a camera in first person i notice that the attributes don't chage till you have completed the move and released the mouse button.. is this going to cause issues?
the attributes DO change, the channelbox just doesn't update... however I have seen that this does kinda affect the scriptJob above...
I would look at the help line, it seems to be able to measure the distance of your camera while it is moving from where it first started moving. Most likely this has something to do with a maya object... seeing as though I do not see anything on a Model panel or modelEditor about annotations or getModifiers.
MegaManZZ
12-04-2009, 04:35 AM
hey lwrath.
Thanks for your replies. Things seem to work fine when using scriptjob!.
i got one problem only and i might want to make a new post for this, but its relatively easy.
im trying to make an expression so an object always stays directly above (+5 on .translateY for example) another objects absolute postion.. i've tried variations but i can't see to get anything to work :(. hope someone can help me out!.
CGTalk Moderation
12-04-2009, 04:35 AM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.