Creating and Retrieving 3ds Max NURBS Objects
CreateNURBSObject()
The CreateNURBSObject()
function takes a NURBSSet
as input and outputs a pointer to an editable NURBS object whose Class_ID is EDITABLE_SURF_CLASS_ID
. For example, this is what all the standard 3ds Max primitives do when they implement Object::ConvertToType()
. If you want to make a node in the scene reference a NURBS object, put the objects into a NURBSSet
and use this function to create the NURBS object. Then pass this object to Interface::CreateObjectNode()
.
- IObjParam* ip - The 3ds Max interface pointer. If non-NULL, this is used to get at the 3ds Max function to do unique naming. If a NULL is specified the names are not made unique.
- NURBSSet *nset - Points to the set of input objects to create. These are defined in object space. The matrix below is used to transform these. For instance, the
NURBSSet
could be defined in a unit cube and themat
parameter could be used to scale it up. Note: The NURBSIds and parent NURBSIds in this NURBS set are filled in the process of doing the creation. Thus, you pass this set in, and the function modifies it so you can work with the set immediately (you don't have to later callGetNURBSSet()
to get an appropriate one to work with). For example, say you create aNURBSCVSurface
using this API and then want to animate some of the CVs on the surface. You'd pass in this set, then when the object is created the CVs on the surface will have the parent ids filled in so you can actually manipulate the surface in the scene. - Matrix3& mat - This is a transformation applied to all of the objects.
GetNURBSSet()
The GetNURBSSet()
function is used to retrieve a NURBSSet
that corresponds to the specified NURBS object. This allows adeveloper to access the internal objects inside a 3ds Max editableNURBS object. If the Relational
parameter is FALSE the NURBSSet
will contain CV curves and CV surfaces. So for example, if you passan object that has a relational model (perhaps two CV surfaces anda dependent blend surface) it will decompose them into three CVsurfaces. This will be the CV surfaces that represent the twosurfaces and the blend, but you won't have the blend relationaldata. If Relational
is TRUE, you'dget back two CV surfaces and a NURBS blend surface. If you get backa relational model, check the type of object using the base classmethod NURBSObject::GetType()
and then cast the object to the appropriate type. Then you may callthat classes methods on the object to work with it.
If you were using this API as part of an export plug-in, you'd probably want to set Relational
to FALSE because getting back a relational blend surface would not be useful, but having CV surface data you could export would. On the other hand, if you simply wanted to animate the tension parameters on the blend surface you'd set Relational
to TRUE and then call the methods of the blend surface object to change the tension parameters (NURBSBlendSurface::SetTension()
).
Important Note: Developers must use the method NURBSSet::DeleteObjects()
when done with the NURBSSet
to free the memory used.
Object *object
- The input object. This need to be a NURBS object (Class_IDEDITABLE_SURF_CLASS_ID
).TimeValue t
- The time at which the object is evaluated and converted.NURBSSet &nset
- ANURBSSet
that corresponds to the specified object is returned here.BOOL Relational
- If TRUE theNURBSSet
will contain relational data; if FALSE theNURBSSet
will contain a CV curve or CV surface equivalent of the object.