Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / Subclass MPxLocatorNode but register kDependNode?
  RSS 2.0 ATOM  

Subclass MPxLocatorNode but register kDependNode?
Rate this thread
 
41131
 
Permlink of this thread  
avatar
  • craig09x
  • Posted: 25 March 2010 03:34 AM
  • Total Posts: 4
  • Joined: 03 August 2009 06:44 PM

Has anybody tried subclassing from MPxLocatorNode but registering the new type as MPxNode::kDependNode? I’d like to do this:

class : public MPxLocatorNode {
 virtual MPxNode
::Type type() const return MPxNode::type() }
}
;
class 
: public A { ... };
// register A as kDependNode
// register B as kLocatorNode

This way A can be a regular DG node, but B can be a DAG node. (If I derive A from MPxNode, and B from MPxLocatorNode, then I can’t have B as a subclass of A). The only method of MPxLocatorNode that overrides something in MPxNode is ‘type’, so I thought about defining A::type to make sure it runs the MPxNode version instead.

Has anybody tried something like this, and observed any ill effects? It appears to work, but who knows down the line…

thanks



Replies: 0
avatar
  • chadmv
  • Posted: 09 April 2010 10:28 AM

A locator node already has compute functionality from kDependNode so I’m not sure why you would want to do this.



Replies: 0
avatar

chadmv 09 April 2010 05:28 PM

A locator node already has compute functionality from kDependNode so I’m not sure why you would want to do this.

I know, but.... I have a class hierarchy in which it’s natural for B to be a subclass of A. It also makes sense (in terms of what I’m doing) to have B as a locator, but not A. I can have both as locators or DG nodes, by deriving A from MPxLocatorNode or MPxNode, but if I want B to be a locator but A a DG node, then I’m stuck. Obviously I can’t change MPxLocatorNode to virtually-inherit from MPxNode. I tried this technique of registering A as a kDependNode and it worked fine, up until the point I wanted to save/load the scene, then Maya started crashing. I’ve had to reorganize my class hierarchy instead, which is a shame.



Replies: 0