CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-07-2013, 10:22 PM   #1
DeadlyNightshade
Plz...
 
DeadlyNightshade's Avatar
portfolio
Martin Dahlin
Jr. Technical Artist
King
Stockholm, Sweden
 
Join Date: Jul 2012
Posts: 922
Int vectors - workaround?

I have a procedure with a switch -statement in it.
Each case has this line:
move -r $someVariable;

Where $someVariable is a vector holding the coordinates.

Problem with this though is that the vector datatype holds 3 floats, not 3 ints - and ints are required by the -r -flag on the move -command, so I get a parsing error.

So how do you solve these kinds of problems?
__________________
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.
 
Old 07-07-2013, 11:48 PM   #2
palohman
Frequenter
portfolio
Paul Lohman
Tech Artist
EA
Orlando, USA
 
Join Date: May 2004
Posts: 144
did you mean your $someVariable is 3 ints and the mel command move wants 3 floats?
cause this is 3 floats:
Code:
move -relative -4.271407 9.254911 -2.669776;

and that works.

I suggest you convert your ints to floats before assigning them to $someVariable.
The other issue you might have is formatting, from the docs;
Code:
move float float float [objects];

print $someVariable and see if it looks like float[space]float[space]float
__________________
blogfolio
 
Old 07-08-2013, 10:40 AM   #3
ristopuukko
Earthling
 
ristopuukko's Avatar
portfolio
Risto Puukko
Senior fx td
FrameStore
London, United%2BKingdom
 
Join Date: Nov 2003
Posts: 813
DeadlyNightshade, try this:

Code:
move -r ($someVariable[0]) ($someVariable[1]) ($someVariable[2]) ;


/r
__________________
- Oh no, it's me -
 
Old 07-08-2013, 09:42 PM   #4
DeadlyNightshade
Plz...
 
DeadlyNightshade's Avatar
portfolio
Martin Dahlin
Jr. Technical Artist
King
Stockholm, Sweden
 
Join Date: Jul 2012
Posts: 922
Quote:
Originally Posted by palohman
did you mean your $someVariable is 3 ints and the mel command move wants 3 floats?
cause this is 3 floats:
Code:
move -relative -4.271407 9.254911 -2.669776;

and that works.

I suggest you convert your ints to floats before assigning them to $someVariable.
The other issue you might have is formatting, from the docs;
Code:
move float float float [objects];

print $someVariable and see if it looks like float[space]float[space]float


No my variable is an int - which is a problem because the vector datatype holds 3 floats. So even if I assign X.0 to it, the move-command will say there's a parsing error (because it is being fed 3 floats instead of 3 ints).

Anyway thanks for your replies guys. They made me realize that I was trying to overcomplicate things. I should've just gone with a 3-slot array and fed the variables to the move command like risto recommended: move -r ($someVariable[0]) ($someVariable[1]) ($someVariable[2]) ;

EDIT: On a side note palohman (seeing that you are TA at EA): What is your recommendation for my current situation: I'm stuck with a... crappy job where boss(es) do not appreciate my technical skills and ideas. How am I supposed to grow to become a TA when the people I work for is so ungrateful and doesn't appreciate a thing I offer them? Another employer is probably the answer but that's an issue because I'm stuck at a place where my portfolio isn't properly updated, and I focus all my free time on technical stuff instead of pure art :( Or short: I have the drive and the mindset (to be a TA) but not a good-enough portfolio to get the heck out of here and into a work environment where I can grow.
__________________
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.

Last edited by DeadlyNightshade : 07-08-2013 at 10:04 PM.
 
Old 07-08-2013, 11:32 PM   #5
palohman
Frequenter
portfolio
Paul Lohman
Tech Artist
EA
Orlando, USA
 
Join Date: May 2004
Posts: 144
I'm familiar with your situation I just kept doing what you're doing(working on my TA skills and portfolio on the side), and kept applying at places for TA positions until a place I liked, liked me.
There are TA jobs out there, keep pushing.
__________________
blogfolio
 
Old 07-09-2013, 05:31 AM   #6
ristopuukko
Earthling
 
ristopuukko's Avatar
portfolio
Risto Puukko
Senior fx td
FrameStore
London, United%2BKingdom
 
Join Date: Nov 2003
Posts: 813
DeadlyNightshade,

the parsing error ( in my opinion ) is raised because you try to feed an array to a function which expects scalars

/risto
__________________
- Oh no, it's me -
 
Old 07-09-2013, 03:59 PM   #7
Keilun
Expert
Keilun
Canada
 
Join Date: Aug 2005
Posts: 738
Quote:
Originally Posted by ristopuukko
DeadlyNightshade,

the parsing error ( in my opinion ) is raised because you try to feed an array to a function which expects scalars

/risto


I'd agree with that assessment. MEL automatically converts between ints and floats as necessary so it should not pose any parsing error. Take for example the following cases:

Code:
// Explicit cast to int. vector $v = <<1.5, 2.5, 3.5>>; $vx = (int) $v.x; $vy = (int) $v.y; $vz = (int) $v.z;


or

Code:
// Implicit cast to int. vector $v = <<1.5, 2.5, 3.5>>; int $vx = $v.x; int $vy = $v.y; int $vz = $v.z;


Both of the above examples will work showing the implicit and explicit type casting between int and float.

The move -r command expects the form:

Code:
move -r <arg1> <arg2> <arg3>


Calling it as:

Code:
move -r $myvector


does not automatically extract the values from the vector. Instead you need to fill each argument in by referencing the components of the vector:

Code:
move -r ($v.x) ($v.y) ($v.z);

Last edited by Keilun : 07-09-2013 at 04:02 PM.
 
Old 07-10-2013, 07:39 AM   #8
djx
Where's my pony?
 
djx's Avatar
David Johnson
vfx & creature td
Melbourne, Australia
 
Join Date: Jun 2003
Posts: 3,464
Quote:
How am I supposed to grow to become a TA when the people I work for is so ungrateful and doesn't appreciate a thing I offer them.
You do realize they might read this. Or someone they know might. (Believe me.. it happens)

I suppose you may not care, but you might be missing opportunities if you burn too many bridges. Maybe they just need to see how much you have to offer in terms of how much money you can make them. Sometimes you need to work on your negotiating skills as well as your TA skills.

David
__________________
http://www.djx.com.au
 
Old 07-10-2013, 07:52 AM   #9
DeadlyNightshade
Plz...
 
DeadlyNightshade's Avatar
portfolio
Martin Dahlin
Jr. Technical Artist
King
Stockholm, Sweden
 
Join Date: Jul 2012
Posts: 922
Quote:
Originally Posted by djx
You do realize they might read this. Or someone they know might. (Believe me.. it happens)

I suppose you may not care, but you might be missing opportunities if you burn too many bridges. Maybe they just need to see how much you have to offer in terms of how much money you can make them. Sometimes you need to work on your negotiating skills as well as your TA skills.

David

I do, and if they take in anything I've written here then that would be a step in the right direction and not the wrong one - because they have a major issue with listening to and trusting their employers. And it's not like I'm trash talking them: I'm showing frustration because they won't allow me to help them in ways I think would be most effective.

I understand that you often have to negotiate and prove people that they are wrong in order to send your message to them - but when you don't even get any chance to show them your ideas then what else can be done? It's a dead end. You can't help people who do not want help.
__________________
Nightshade UV Editor (script for Maya) - Extends Maya's default UV Texture Editor with additional tools.

Last edited by DeadlyNightshade : 07-10-2013 at 07:58 AM.
 
Old 07-10-2013, 07:52 AM   #10
CGTalk Moderation
Expert
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,478
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:35 PM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.