View Full Version : mel script not working on meter units
Aikiman 06-18-2008, 08:22 AM I have a mel script that sets up initial particle and locator positions at frame 1, all works fine until I decided to change the units to meters and check it again. Although the locators position themselves relative to the scene scale, ie 20 units in Y is just that, whether its in cm or meters which is how I want it. However the particles do not conform to the same conversion, they still seem to position themselves in cm and not scale up to meters. The values for the particle positions are generated from initial values that are set on one of the control locators. Its seems it may these these values that are being read as cm but I cant see how that is unless there are hidden values. Perhaps I need to query the scene units and then adjust the values as the script loads, in which case how do I query that value or what else can I do here? cheers
|
|
Gravedigger
06-18-2008, 08:57 AM
well how do you set those particle positions?
anyway you can query the current unit with the `currentUnit` command.
to get the current linear unit use this one:
currentUnit -query -linear;
hope this helps!
grs Gravedigger
don't know the solution to your issue, but to query the current unit use:
currentUnit -q -linear
Aikiman
06-18-2008, 09:06 AM
Hey thanks for response, basically the particle position uses sin and cos of pos.x and pos.z so that they revolve and then this is multiplied by a predetermined initial value set up on a control null that the user can change once the script has loaded. These values range from 2-4 on initial setup.
The setup is a little bit more involved than this as it uses locator positions as start and end positions over the lifespan of particles so its somewhere in its translation of world space values for all these things that isnt passing through as the scene units get bigger.
ill try the currentUnit command and see if I can scale everything up by 100 if meters is set to true.
NaughtyNathan
06-18-2008, 09:17 AM
Maya is a PAIN IN THE ASS when it comes to internal linear units.
Maya works internally IN CM ONLY so it doesn't matter WHAT units you've set to, if you're not in cm many functions will appear to work incorrectly or at 100 times too small (or big, I forget which way it goes! :D)
tons of stuff goes horribly wrong if you switch from cm so my advice is DON'T EVER CHANGE IT, but pretend 1cm is equal to 1m... you'll thanks me one day. :)
but if you HAVE to make your script work in m then yes, you will have to multiply everything by 100. Here's a line I have to put at the top of most of our scripts (although we stay in cm, some of our sister studios use m.. :( )
int $M = (`currentUnit -q -l` == "m") ? 100 : 1;
then I just multiply all appropriate values by $M, so it works whether you're in cm or m. of course it'll break if you're in something else like feet/inches.. :D
:nathaN
Aikiman
06-18-2008, 09:47 AM
Maya is a PAIN IN THE ASS when it comes to internal linear units.
Maya works internally IN CM ONLY so it doesn't matter WHAT units you've set to, if you're not in cm many functions will appear to work incorrectly or at 100 times too small (or big, I forget which way it goes! :D)
tons of stuff goes horribly wrong if you switch from cm so my advice is DON'T EVER CHANGE IT, but pretend 1cm is equal to 1m... you'll thanks me one day. :)
but if you HAVE to make your script work in m then yes, you will have to multiply everything by 100. Here's a line I have to put at the top of most of our scripts (although we stay in cm, some of our sister studios use m.. :( )
int $M = (`currentUnit -q -l` == "m") ? 100 : 1;
then I just multiply all appropriate values by $M, so it works whether you're in cm or m. of course it'll break if you're in something else like feet/inches.. :D
:nathaN
lol what a mind ****! Anyway I will use your code and see how I go. One thing that is still bothering me is I am using xform to get the locators world space and when I check the world space of the locators they still say 20 units in Y for example both in cm and m but the particles still cant see the values the xform returns :argh: (I need the head banging wall smiley please CG soc) and their positions look like 0.02 instead, maybe Ill try and use your code on the xform returns as well.
Thanks for you help ppl.
Aikiman
06-18-2008, 10:12 AM
oh I found the code that will work here...
confirmDialog
-title "Ooops..."
-message "You scene must be in cm units"
-button "close"
;
done!
CGTalk Moderation
06-18-2008, 10:12 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.