MEL object naming problem

Become a member of the CGSociety

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

Thread Tools Display Modes
  07 July 2013
MEL object naming problem

here is part of my MEL code.

 file -import -type "OBJ" -ra true -mergeNamespacesOnClash false -namespace "input_HEAD" -options "mo=1"  -pr $headpaths;
 float $head_width_1[3] = `xform -q -ws -t input_HEAD:Mesh.vtx[1700]`;

// Error: line 29: No object matches name: input_HEAD:Mesh.vtx[1700]

the problem is there are already something existed in the scene.
After i import the object , the name of the object that i just imported is not the same as i "expect" when i am coding, so how can I make sure the name of the object that it will become after it have been imported in the scene.

  07 July 2013
You could just add "001" to your namespace if it already exist in your scene.
And then, you can use the namespace versioning in your code.

Hope it help.
My Blog
My Vimeo
  07 July 2013
if you are having custom namespace this make the query little bit easier ,because you can query just the namespace that you are giving to the file when you are importing it.For example lets say that I have obj file called "who_let_the_dogs_out.obj" with the exported data.
I can query it after import using your code but instead of using the full name I will use who_let_the_dogs_out*.vtx[1700].

Also interesting thing if you import the same *.obj more then once you will see that the name changes,because maya is saving the previous import O_o(?).For example if you import the file mentioned above for the first time it will be "who_let_the_dogs_out:blablablabla" however if you delete it and import it again in the same scene it will be "who_let_the_dogs_out1.blablablabla" etc. which could cause problem with your query as well :>.

Hope this helps if not sry for wasting your time T_T.
Maya Fluids own xD.
Graduate xD
  07 July 2013
Are there any better OBJ import naming controls?

I'm facing a similar situation where a Mel script is loading and processing a variable number of obj geometries, and I'm looking around somewhat confused by the lack of naming control. There must be some common technique people use for control over the assigned names of a imported obj geometry.

A part of this is looking for how the naming assignment works. Some obj's get the name of their first non-default poly group, while others simply get "Mesh". Why?

For those seeking similar info, here's my current best logic. Love to locate better. This makes "file" return an array of the created nodes, two in my test cases, where element zero is the mesh transform (I think, still learning...) They get the 'a3da' namespace, and I can get the node names, but I don't understand how Mel arrives at the names.

  	namespace -add a3da;
  	namespace -set a3da;
  	string $ret[], $code;
    	$code = "file -import -type \"OBJ\" -rnn -options \"mo=1\" attachGeom005.obj";
    	print ($code + "\n");
    	$ret = eval( $code );
    	print $ret;
    	print ("\n and element zero is: " + $ret[0] + "\n");

  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
Society of Digital Artists

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

All times are GMT. The time now is 11:15 AM.

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