PDA

View Full Version : Import Geometry Node (API) <- Gathering ideas and tips!


aghawa
11-07-2010, 08:12 PM
Hey guys! :D
I'm trying to start working with maya python API, and I'd like to implement a node which allows for importing a geometry using a path (editable). Basically, to load file sequences (.obj for now).

That being said, before starting diving into the code and get stuck after 4 minutes, I'm starting to gather ideas, tips and whatsoever about this objective.

Probably someone of you already created something like this in the past so can give useful advice! :D

It's not the syntax that worries me, more the way I have to walk to achieve this in the best (and easiest! :P ) possible way.

Sparse questions:
One of the attributes should definitely be the time - which has to affect the node path attr to update everytime the time changes. Right?
Because I'm wondering how is the "#" character handled inside the API, is it simply a wildcard I need to find and replace with the framenumber?

Is it easier to use the "import" command from MEL to reload everytime the new geometry whenever the path changes? Or is there some better way?

Well, anything you can say about the subject, I will appreciate it :D

Thanks,
Aghawa

darkjedi1929
11-08-2010, 06:25 AM
Is it easier to use the "import" command from MEL to reload everytime the new geometry whenever the path changes? Or is there some better way?

I don't think it will be a great idea to go down this road....imagine doing the import command for a length of animation....

Over the top of my head, you might have to write something like a cacheNode...if I am not mistaken. Of course, the cacheNode doesn't import any geometry, but it reads and updates geometry from external files.

Just a thought, how about a modified cacheNode, where you create a placeholder geometry and plug in the file for it to build the data from there?

aghawa
11-08-2010, 02:33 PM
I don't think it will be a great idea to go down this road....imagine doing the import command for a length of animation....

Over the top of my head, you might have to write something like a cacheNode...if I am not mistaken. Of course, the cacheNode doesn't import any geometry, but it reads and updates geometry from external files.

Just a thought, how about a modified cacheNode, where you create a placeholder geometry and plug in the file for it to build the data from there?

Sounds smart :P
Thanks for chiming in!

So basically, I'd create a "manager" node, with the filename of the geo that updates with the time, which updates a mesh node which gets rewritten each time with the new geo, right?

In that case, I suppose I'd have to "parse" the geometry from the obj file...does Maya provide the OBJ apis to parse it in an easy way or do I have to read the file and organize everything by hand?

Cheers

darkjedi1929
11-09-2010, 05:27 AM
Kind of, yeah. No idea about the obj APIs, you could look into Maya's Plugin Dev Kit for an example plugin on importing objs. That particular plugin is in C++ though.

coming back to the analogy of the cacheNode, the cacheNode is a deformer. Therefore, you will have to make a generator node, like the one we get when we first create a torus or something. It's like a generator node feeding into an ordinary polyShape node. That should work out.

Best of luck mate, I think this is gonna be a doozy for you:bounce:

Also, you'll probably be better off using C++ over Python for this, IMO.

CGTalk Moderation
11-09-2010, 05:27 AM
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.