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-10-2013, 11:35 AM   #1
United Kingdom
Join Date: Aug 2009
Posts: 48
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.

Old 07-10-2013, 03:55 PM   #2
Infiltatring the industry
Paris, France
Join Date: May 2010
Posts: 139
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
Old 07-16-2013, 07:37 PM   #3
kdronez's Avatar
Veselin Gyurov
Noobie xD
Searching for Job T_T.
United Kingdom
Join Date: Mar 2009
Posts: 202
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
Old 07-18-2013, 05:55 PM   #4
New Member
Blake Senftner
Burbank, USA
Join Date: Oct 2007
Posts: 5
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");

Old 07-18-2013, 05:55 PM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,479
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
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 09:17 AM.

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