Jump to content
  • Advertisement
GreenGodDiary

C++ [MAYA API] MItDependencyGraph won't iterate properly

Recommended Posts

I have a function that takes in an MObject and is supposed to iterate its children and print any nodes it comes across using MItDependencyGraph:
 

void QueueChildrenTransforms(MObject& node)
{
	MItDependencyGraph it
	(
		node, 
		MFn::kInvalid, 
		MItDependencyGraph::kDownstream, 
		MItDependencyGraph::kBreadthFirst, 
		MItDependencyGraph::kNodeLevel
	);

	MString s = "Found: ";
	for (; !it.isDone(); it.next())
	{
		MFnDagNode child(it.currentItem());
		s += child.name();
		s += " ";
	}
	MGlobal::displayInfo(s);
}


When it is called, it only outputs the name of the node passed in to it. (If i use kInvalid as filter, which should iterate all nodes)

It doesn't seem to make a difference changing the direction or traversal priority.

I've tried different filteres as well such as kTransform and kMesh (these are the ones I want in the end, but using these filter seem to not output even the node passed in)

I'm not sure if im using the correct type of iterator for this but this is the only one I've found that lets you define the root node of the search, which I need to do.
 

So what am I missing here?


End goal is to pass in a transform node, and iterate through its children in order to queue any transforms found for export.

 

Share this post


Link to post
Share on other sites
Advertisement

Solved it by doing the following:

	MItDag it(MItDag::kDepthFirst, MFn::kTransform);
	it.reset(node, MItDag::kDepthFirst, MFn::kTransform);

though I am still curious as to why the original approach didn't work..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!