View Full Version : accessing polys through the API
leach 04-07-2003, 07:00 PM through the API is it possible to set custom attributes at the individual poly level.
for example, i have a custom file format for a graphics engine which objects will be exported to, and i need to be able to set certain flags on individual polys, such as - are they to be used for collision detection. is this an easy thing to do?
also, the hypergraph is capable of displaying group nodes and object nodes, would it be possible to add an extra node that relates to the individual polys, so i could select a node in the hypergraph, which would select its relevant poly?
Has anyone had experiance at a company that needed to add this sort of behaviour into maya? i would be interested in hearing what experiances people have had adopting maya for use within they're own graphics engines.
thanks
leach
|
|
playmesumch00ns
04-07-2003, 10:08 PM
I've not had experience from the point of view of writing a game engine, but I've a couple of thoughts on what you describe...
You could create an MPxLocator-derived node into which you plug your mesh. On this node you could keep a series of array attributes (i.e. attributes that are arrays, not arrays of attributes) that relate to the flags you want to set and map one-to-one onto the polys in the mesh. You can then change the values of the flags by writing some commands which accept the name of the MPxLocator node and the face indices as parameters. Using an MPxLocator node you can also draw helpers in the viewport to visualize the state of the flags. Alternatively, you could create a custom shape node which would handle all this stuff, but that would be a lot more work to set up I think -- check the manuals and try the maya-dev mailing list at Highend.
For setting flags on individual polys, you might (just might) be able to do this through MEL. You can just create a series of arrays for each object (which again map one-to-one onto the polys), then use MEL procs to set the values of these flags. You can retrieve the values of these flags when you export by querying the value of the arrays using a MEL script from inside the plug-in.
I'm not sure if you can create a node that acts on individual components, or if you'd want to. If you just want to get/set the value of flags for a paricular face, then it's trivial to write a MEL UI that you can open with a bunch of faces as parameters.
hope this helps:)
pyromania
04-07-2003, 11:57 PM
This is a perfect job for the Blind data editor. It was designed for situations like this.
Window>>General Editors>>Blind Data Editor
With blind data you can setup various id's and values and assign them to on a object, face or vertex basis. Whats great about this is that maya will ignore the blind data, so you won't have to worry about it affecting your other objects.
I'm sure the maya MEL reference or the API reference has plenty of stuff on querying blind data. So setting up an exporter should be very easy.
CGTalk Moderation
01-14-2006, 08:00 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.