PDA

View Full Version : Importing and Namespaces


wjpiovano
02-29-2008, 12:38 AM
I've been having some trouble with importing and namespaces. I have a function which imports and then deletes a couple of objects. This function is called several times, and when the same objects are re-imported, even after having been deleted, there are clashes in nodes.

So I decided to have a parameter $namespace which allows the calls to differentiate the objects imported. Only problem is, if I pass "one", then the first object will be "one:objName" but the next object I import in the function gets called "one1:obj2Name". When I try to delete these namespaces after I delete the objects, it still says "namespace not empty". So I end up having "one17:objName" or the like in later calls, and of course I can't select my object cause I don't know what namespace Maya has pulled out for it at that point.

I'm not sure what the best solution is. Should I be using namespaces at all? Is there a way to find out what namespace has been assigned to the imported object?

Thanks.

Robert Bateman
02-29-2008, 10:37 AM
delete "*:objName";

wjpiovano
03-01-2008, 07:58 PM
Hey. That would work really well, but for some reason when I have an object called one:Set2_object0 the following query:
select "*:Set2_object0"
says it can't find any object of name *:Set2_object0. Looks like it's not recognizing the wildcard. I tried reading up on them, and on regular expressions too, and it seems right to me. Am I doing something wrong?

greatPumpkin
03-01-2008, 10:37 PM
maya can be a bit finicky about what it does depending on the current namespace, and some commands will only give you stuff contained in the current namespace, if you want a better way of getting stuff inside of wildcards, try:

select `ls -r 1 "*:objectName"`;

the r 1 is a flag for recursive, meaning maya will search all available namespaces for what your looking for-

wjpiovano
03-03-2008, 01:54 PM
Yep, thanks, that's working perfectly!

CGTalk Moderation
03-03-2008, 01:54 PM
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.