View Full Version : imported item's name?


RonGriswold
05 May 2006, 12:55 AM
Hi,

Does anyone know how to get the name of an item imported using the file command? For example:

file -import "test.obj";

Depending upon the way the .obj file is written the object might be Mesh1 or polySurface1 or a group name or...

Unfortunatly the file command doesn't return this name(s), instead it returns the file name.

Anyone know how to get this info?

Thanks,

ron

jtilden20
05 May 2006, 07:14 AM
Usually when you import a scene or create a reference it selects the objects that you just brought in. Therefore you should just be able to do an `ls -sl` immediately after the import/reference. This is what I usually do... dirty it seems, but thats the only way that I know.

RonGriswold
05 May 2006, 12:01 AM
Hi Jonathan,

Thanks for the reply. Unfortunatly the item does not seem to be selected when i do an import.

I have found an *extreme* hack to get around it, but its ugly. You can use the -gr and -gn flags to `file` to have the item grouped under a transform that you supply the name for. You can then get to the imported item, unparent it, then delete the group node... ugh.

Segmoria
05 May 2006, 04:20 PM
Sounds like it should do the job.

An even more "extreme" approach would be to store all the objects/nodes in your scene into an array, import a file, store again all the objects/nodes into a new array and then compare those arrays, the difference ofcourse would be the newly imported objects.
But I can only imagine how slow this process can become in scenes packed with many items.

technopriest
05 May 2006, 02:52 PM
your grouping solution is pretty clever.

i use a custom namespace when importing files so that i predict what the name of the imported file will be. the object names in the files i import are always the same as the filename.

lucille
05 May 2006, 03:27 PM
This will return new root level nodes--which is gernerally what I want--
but the same approach could return other imported nodes


string $preImportRootLevelNodes[] = `ls -assemblies`;

//import command

string $postImportRootLevelNodes[] = `ls -assemblies`;

string $importRootLevelNodes[]=stringArrayRemove
($preImportRootLevelNodes,$postImportRootLevelNodes);

RonGriswold
05 May 2006, 07:05 PM
lucille, that's perfect! Thank you so much.

ron

CGTalk Moderation
05 May 2006, 07:05 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.


1