How to get the status of Mesh updates?

How to get the status of Mesh updates?

Anonymous
Not applicable
591 Views
1 Reply
Message 1 of 2

How to get the status of Mesh updates?

Anonymous
Not applicable

Hi dear Max community!

 

Using this function I read mesh data for my external renderer:

	// Collect CentiLeo data from 3ds max data
	if( Object* obj = node->EvalWorldState( t ).obj )
	{	
		if( GeomObject* geo = (GeomObject*)obj )
		{
			if( obj->CanConvertToType( triObjectClassID ) )
			{
			//	BOOL deleteMesh;
				NullView nw;

				Mesh * mesh = geo->GetRenderMesh( t, node, nw, deleteMesh );
// do my things

 

This procedure converts any input (based on patches, splines or some meshes) into triangles and later it is sent to external interactive renderer.

But in some cases there are a lot of INodes in the scene or the meshes can be large or smooth modifiers may be connected to objects. That's why calling this code is expensive.

 

When I process the event on TimeChanged based on the class TimeChangeCallback I have new TimeValue t and later I iterate over all scene INodes, give them updated t and request to compute the meshes. 

But in reality for the new value of t some meshes are changed and some are not (and their modifiers are not changed). 

 

Is there any flag like getDirty() or INode->GeometryChanged() in Max or are there any mechanisms which will allow me to check if the underlying mesh of the INode has changed since previous time or not. Based on this I want to avoid recomputing the mesh for new value of t where it hasn't changed..

0 Likes
592 Views
1 Reply
Reply (1)
Message 2 of 2

attilaszabo
Alumni
Alumni

You could ask the Object* obj for its validity by calling Interval Object::ObjectValidity(TimeValue t). If the validity interval is non-empty, it means that the geometry has not changed and therefore you don't need to re-process it again.

 

I hope this helps,

 

 

Attila Szabo
Product Owner, 3ds Max
Autodesk
0 Likes