Class ImpNode

3DS Max Plug-In SDK

Class ImpNode

See Also: Class ImpInterface, Class INode, Class Matrix3, Class Point3.

class ImpNode

Description:

Import Node class. Methods of this class may be used to set various properties of the node. All methods of this class are implemented by the system.

Sample Code:

The following sample code fragment (from \MAXSDK\SAMPLES\IMPEXP\DXFIMP.CPP) demonstrates the use of many of the methods of this class.

ImpNode *node = iface->CreateNode();

if (node) {

 TriObject *tri = CreateNewTriObject();

 // Now find the center of the vertices and use that as the pivot

 int verts = m->getNumVerts();

 Point3 accum(0,0,0);

 for(int i = 0; i < verts; ++i)

  accum += m->verts[i];

 Point3 delta = accum / (float)verts;

 for(i = 0; i < verts; ++i)

  m->verts[i] -= delta;

 tri->mesh = *m;

 node->Reference(tri);

 Matrix3 tm;

 tm.IdentityMatrix();// Reset initial matrix to identity

 tm.SetTrans(delta); // Add in the center point

 node->SetTransform(0,tm);

 iface->AddNodeToScene(node);

 node->SetName(_T(n->name));

 }

Methods:

Prototype:

virtual RefResult Reference(ObjectHandle obj) = 0;

Remarks:

Sets the object that this node references.

Parameters:

ObjectHandle obj

The object to reference.

Return Value:

One of the following values:

 REF_FAIL

The operation failed.

 REF_SUCCEED

The operation succeeded.

Prototype:

virtual void SetTransform( TimeValue t, Matrix3 tm ) = 0;

Remarks:

Sets the transformation matrix of the node.

Parameters:

TimeValue t

The time to set the matrix.

Matrix3 tm

The new transformation matrix of the node.

Prototype:

virtual void SetName(const TCHAR *newname) = 0;

Remarks:

Sets the name of the node.

Parameters:

const TCHAR *newname

The new name for the node.

Prototype:

virtual void SetPivot(Point3 p) = 0;

Remarks:

Sets the pivot point of the node.

Parameters:

Point3 p

The pivot point of the node.

Prototype:

virtual INode *GetINode()=0;

Remarks:

Returns the INode pointer for the node.