Int vectors - workaround?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  07 July 2013
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.
 
  07 July 2013
did you mean your $someVariable is 3 ints and the mel command move wants 3 floats?
cause this is 3 floats:
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;
move float float float [objects];

print $someVariable and see if it looks like float[space]float[space]float
__________________
blogfolio
 
  07 July 2013
DeadlyNightshade, try this:


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


/r
__________________
- Oh no, it's me -
 
  07 July 2013
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:
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;
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 July 2013 at 10:04 PM.
 
  07 July 2013
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
 
  07 July 2013
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 -
 
  07 July 2013
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:

// 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

// 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:

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


Calling it as:

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:

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

Last edited by Keilun : 07 July 2013 at 04:02 PM.
 
  07 July 2013
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
 
  07 July 2013
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 July 2013 at 07:58 AM.
 
  07 July 2013
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



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 05:48 AM.


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