This reference page is linked to from the following overview topics: Particle System Plug-ins, Plug-in Base Classes.
#include <simpobj.h>
Public Member Functions |
|
CoreExport | SimpleParticle () |
CoreExport | ~SimpleParticle () |
CoreExport void | Update (TimeValue t, INode *node=NULL) |
CoreExport void | UpdateMesh (TimeValue t) |
CoreExport void | GetBBox (TimeValue t, Matrix3 &tm, Box3 &box) |
void | MeshInvalid () |
void | ParticleInvalid () |
CoreExport void | BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev) |
CoreExport void | EndEditParams (IObjParam *ip, ULONG flags, Animatable *next) |
CoreExport int | HitTest (TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) |
This method is called to determine if the
specified screen point intersects the item. |
|
CoreExport int | Display (TimeValue t, INode *inode, ViewExp *vpt, int flags) |
This is called by the system to have the
item display itself (perform a quick render in viewport, using the
current TM). |
|
CoreExport IParamArray * | GetParamBlock () |
An object or modifier should implement this
method if it wishes to make its parameter block available for other
plug-ins to access it. |
|
CoreExport int | GetParamBlockIndex (int id) |
If a plug-in makes its parameter block
available (using
GetParamBlock()) then it will need to provide #defines for
indices into the parameter block. |
|
int | DoOwnSelectHilite () |
If an object wants to draw itself in the 3D
viewports in its selected state in some custom manner this method
should return nonzero. |
|
CoreExport ObjectState | Eval (TimeValue time) |
This method is called to evaluate the object
and return the result as an
ObjectState. |
|
void | InitNodeName (MSTR &s) |
This is the default name of the node when it
is created. |
|
CoreExport Interval | ObjectValidity (TimeValue t) |
This method returns the validity interval of
the object as a whole at the specified time. |
|
CoreExport int | CanConvertToType (Class_ID obtype) |
Indicates whether the object can be
converted to the specified type. |
|
CoreExport Object * | ConvertToType (TimeValue t, Class_ID obtype) |
This method converts this object to the type
specified and returns a pointer it. |
|
CoreExport Object * | MakeShallowCopy (ChannelMask channels) |
This method must make a copy of its "shell"
and then shallow copy (see below) only the specified channels.
|
|
void | WSStateInvalidate () |
This is called by a node when the node's
world space state has become invalid. |
|
BOOL | IsWorldSpaceObject () |
Returns TRUE if the object as a world space
object; otherwise FALSE. |
|
CoreExport void | GetWorldBoundBox (TimeValue t, INode *inode, ViewExp *vpt, Box3 &box) |
This method returns the world space bounding
box for Objects (see below for the Sub-object gizmo or Modifiers
gizmo version). |
|
CoreExport void | GetLocalBoundBox (TimeValue t, INode *inode, ViewExp *vpt, Box3 &box) |
This is the object space bounding box, the
box in the object's local coordinates. |
|
CoreExport void | GetDeformBBox (TimeValue t, Box3 &box, Matrix3 *tm, BOOL useSel) |
This method computes the bounding box in the
objects local coordinates or the optional space defined by tm.
|
|
CoreExport void | ApplyForceField (ForceField *ff) |
This method is called to add the force field
object passed to the list of force field objects operating on this
particle system. |
|
CoreExport BOOL | ApplyCollisionObject (CollisionObject *co) |
This method is called to add the collision
object passed to the list of collision objects operating on this
particle system. |
|
CoreExport TimeValue | ParticleAge (TimeValue t, int i) |
Returns the age of the specified particle --
the length of time it has been 'alive'. |
|
CoreExport void | SetParticlePosition (TimeValue t, int i, Point3 pos) |
CoreExport void | SetParticleVelocity (TimeValue t, int i, Point3 vel) |
CoreExport void | SetParticleAge (TimeValue t, int i, TimeValue age) |
void | GetClassName (MSTR &s) |
Retrieves the name of the plugin class.
|
|
int | NumSubs () |
Animatable * | SubAnim (int i) |
CoreExport MSTR | SubAnimName (int i) |
CoreExport void * | GetInterface (ULONG id) |
Inherited from Animatable. |
|
int | NumRefs () |
Returns the total number of references this
ReferenceMaker can hold. |
|
RefTargetHandle | GetReference (int i) |
Returns the 'i-th' reference. |
|
CoreExport RefResult | NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message) |
Receives and responds to messages. |
|
virtual void | UpdateParticles (TimeValue t, INode *node)=0 |
virtual void | BuildEmitter (TimeValue t, Mesh &amesh)=0 |
virtual Interval | GetValidity (TimeValue t)=0 |
virtual MarkerType | GetMarkerType () |
virtual BOOL | OKtoDisplay (TimeValue t) |
virtual BOOL | EmitterVisible () |
virtual void | InvalidateUI () |
virtual ParamDimension * | GetParameterDim (int pbIndex) |
virtual MSTR | GetParameterName (int pbIndex) |
Public Attributes |
|
IParamBlock * | pblock |
ParticleSys | parts |
TimeValue | tvalid |
BOOL | valid |
Tab< ForceField * > | fields |
Tab< CollisionObject * > | cobjs |
Mesh | mesh |
Interval | mvalid |
MetaParticle | metap |
Static Public Attributes |
|
static CoreExport SimpleParticle * | editOb |
static CoreExport IObjParam * | ip |
Protected Member Functions |
|
virtual void | SetReference (int i, RefTargetHandle rtarg) |
Stores a
ReferenceTarget as its 'i-th' reference`. |
CoreExport SimpleParticle | ( | ) |
CoreExport ~SimpleParticle | ( | ) |
CoreExport void Update | ( | TimeValue | t, |
INode * | node = NULL |
||
) |
CoreExport void UpdateMesh | ( | TimeValue | t | ) |
void MeshInvalid | ( | ) | [inline] |
void ParticleInvalid | ( | ) | [inline] |
{valid=FALSE;}
CoreExport void BeginEditParams | ( | IObjParam * | ip, |
ULONG | flags, | ||
Animatable * | prev | ||
) | [virtual] |
ip | Interface pointer. The developer can use it to call methods such as AddRollupPage(). Note that this pointer is only valid between BeginEditParams() and EndEditParams(). It should not be used outside this interval. |
flags | Describe which branch of the command panel or dialog the item
is being edited in. The following are possible values: BEGIN_EDIT_CREATE Indicates an item is being edited in the create branch. BEGIN_EDIT_MOTION Indicates a controller is being edited in the motion branch. BEGIN_EDIT_HIERARCHY Indicates a controller is being edited in the Pivot subtask of the hierarchy branch. BEGIN_EDIT_IK Indicates a controller is being edited in the IK subtask of the hierarchy branch. BEGIN_EDIT_LINKINFO Indicates a controller is being edited in the Link Info subtask of the hierarchy branch. |
prev | Pointer to an Animatable object. This parameter may be used in the motion and hierarchy branches of the command panel. This pointer allows a plug-in to look at the ClassID of the previous item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel, but simply update the values displayed in the UI fields. This prevents the UI from 'flickering' when the current item begins its edit. For example, if you are in the motion branch and are looking at an item's PRS controller values, and then select another item that is displayed with a PRS controller, the UI will not change - only the values displayed in the fields will change. If however you selected a target camera that has a lookat controller (not a PRS controller) the UI will change because a different set of parameters need to be displayed. Note that for items that are edited in the modifier branch this field can be ignored. |
Reimplemented from Animatable.
CoreExport void EndEditParams | ( | IObjParam * | ip, |
ULONG | flags, | ||
Animatable * | next | ||
) | [virtual] |
ip | An interface pointer. The developer may use the interface
pointer to call methods such as DeleteRollupPage(). |
flags | The following flag may be set: END_EDIT_REMOVEUI If TRUE, the item's user interface should be removed. |
next | Animatable pointer. Can be used in the motion and hierarchy branches of the command panel. It allows a plug-in to look at the ClassID of the next item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel. Note that for items that are edited in the modifier branch this field can be ignored. |
Reimplemented from Animatable.
CoreExport int HitTest | ( | TimeValue | t, |
INode * | inode, | ||
int | type, | ||
int | crossing, | ||
int | flags, | ||
IPoint2 * | p, | ||
ViewExp * | vpt | ||
) | [virtual] |
This method is called to determine if the specified screen point intersects the item.
The method returns nonzero if the item was hit; otherwise 0.
t | The time to perform the hit test. |
inode | A pointer to the node to test. |
type | The type of hit testing to perform. See Scene and Node Hit Test Types. for details. |
crossing | The state of the crossing setting. If TRUE crossing selection is on. |
flags | The hit test flags. See Scene and Node Hit Testing Flags for details. |
p | The screen point to test. |
vpt | An interface pointer that may be used to call methods associated with the viewports. |
Reimplemented from BaseObject.
This is called by the system to have the item display itself (perform a quick render in viewport, using the current TM).
Note: For this method to be called the object's validity interval must be invalid at the specified time t. If the interval is valid, the system may not call this method since it thinks the display is already valid.
t | The time to display the object. |
inode | The node to display. |
vpt | An interface pointer that may be used to call methods associated with the viewports. |
flags | See Display Flags. |
Reimplemented from BaseObject.
CoreExport IParamArray* GetParamBlock | ( | ) | [virtual] |
An object or modifier should implement this method if it wishes to make its parameter block available for other plug-ins to access it.
The system itself doesn't actually call this method. This method is optional.
Reimplemented from BaseObject.
CoreExport int GetParamBlockIndex | ( | int | id | ) | [virtual] |
If a plug-in makes its parameter block available (using GetParamBlock()) then it will need to provide #defines for indices into the parameter block.
These defines should not be directly used with the parameter block but instead converted by this function that the plug-in implements. This way if a parameter moves around in a future version of the plug-in the #define can be remapped. A return value of -1 indicates an invalid parameter id.
id | The parameter block id. See Parameter Block IDs. |
Reimplemented from BaseObject.
int DoOwnSelectHilite | ( | ) | [inline, virtual] |
If an object wants to draw itself in the 3D viewports in its selected state in some custom manner this method should return nonzero.
If this item returns nonzero, the BaseObject::Display() method should respect the selected state of the object when it draws itself. If this method returns zero the system will use its standard method of showing the object as selected.
Reimplemented from Object.
{return TRUE;}
CoreExport ObjectState Eval | ( | TimeValue | t | ) | [virtual] |
This method is called to evaluate the object and return the result as an ObjectState.
When the system has a pointer to an object it doesn't know if it's a procedural object or a derived object. So it calls Eval() on it and gets back an ObjectState. A derived object managed by the system may have to call Eval() on its input for example. A plug-in (like a procedural object) typically just returns itself. A plug-in that does not just return itself is the Morph Object (/MAXSDK/SAMPLES/OBJECTS/MORPHOBJ.CPP). This object uses a morph controller to compute a new object and fill in an ObjectState which it returns.
t | Specifies the time to evaluate the object. |
{ return ObjectState(this); }
Implements Object.
void InitNodeName | ( | MSTR & | s | ) | [inline, virtual] |
This is the default name of the node when it is created.
s | The default name of the node is stored here. |
Reimplemented from GeomObject.
{s = GetObjectName();}
CoreExport Interval ObjectValidity | ( | TimeValue | t | ) | [virtual] |
This method returns the validity interval of the object as a whole at the specified time.
t | The time to compute the validity interval. |
Reimplemented from Object.
CoreExport int CanConvertToType | ( | Class_ID | obtype | ) | [virtual] |
Indicates whether the object can be converted to the specified type.
If the object returns nonzero to indicate it can be converted to the specified type, it must handle converting to and returning an object of that type from ConvertToType().
obtype | The Class_ID of the type of object to convert to. See Class Class_ID, List of Class_IDs. |
Reimplemented from Object.
This method converts this object to the type specified and returns a pointer it.
Note that if ConvertToType() returns a new object it should be a completely different object with no ties (pointers or references) to the original.
if (os->GetTM()) { Matrix3 tm = *(os->GetTM()); for (int i=0; i<triOb->mesh.getNumVerts(); i++) { triOb->mesh.verts[i] = triOb->mesh.verts[i] *tm; } os->obj->UpdateValidity(GEOM_CHAN_NUM,os->tmValid()); os->SetTM(NULL,FOREVER); }
t | The time at which to convert. |
obtype | The Class_ID of the type of object to convert to. See Class Class_ID, List of Class_IDs. |
// Retrieve the TriObject from the node int deleteIt; TriObject *triObject = GetTriObjectFromNode(ip->GetSelNode(0),deleteIt); // Use the TriObject if available if (!triObject) return; // ... // Delete it when done... if (deleteIt) triObject->DeleteMe(); // Return a pointer to a TriObject given an INode or return NULL // if the node cannot be converted to a TriObject TriObject *Utility::GetTriObjectFromNode(INode *node, int &deleteIt) { deleteIt = FALSE; Object *obj = node->EvalWorldState(0).obj; if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) { TriObject *tri = (TriObject *) obj->ConvertToType(0,Class_ID(TRIOBJ_CLASS_ID, 0)); // Note that the TriObject should only be deleted // if the pointer to it is not equal to the object // pointer that called ConvertToType() if (obj != tri) deleteIt = TRUE; return tri; } else { return NULL; } }
Reimplemented from Object.
CoreExport Object* MakeShallowCopy | ( | ChannelMask | channels | ) | [virtual] |
This method must make a copy of its "shell" and then shallow copy (see below) only the specified channels.
It must also copy the validity intervals of the copied channels, and invalidate the other intervals.
channels | The channels to copy. |
Reimplemented from Object.
void WSStateInvalidate | ( | ) | [inline, virtual] |
This is called by a node when the node's world space state has become invalid.
Normally an object does not (and should not) be concerned with this, but in certain cases like particle systems an object is effectively a world space object an needs to be notified.
Reimplemented from Object.
{valid = FALSE;}
BOOL IsWorldSpaceObject | ( | ) | [inline, virtual] |
Returns TRUE if the object as a world space object; otherwise FALSE.
World space objects (particles for example) can not be instanced because they exist in world space not object space. Objects other than particle system can just use the default implementation.
Reimplemented from Object.
{return TRUE;}
This method returns the world space bounding box for Objects (see below for the Sub-object gizmo or Modifiers gizmo version).
The bounding box returned by this method does not need to be precise. It should however be calculated rapidly. The object can handle this by transforming the 8 points of its local bounding box into world space and take the minimums and maximums of the result. Although this isn't necessarily the tightest bounding box of the objects points in world space, it is close enough.
t | The time to compute the bounding box. |
inode | The node to calculate the bounding box for. |
vp | An interface pointer that can be used to call methods associated with the viewports. |
box | Contains the returned bounding box. |
Reimplemented from BaseObject.
This is the object space bounding box, the box in the object's local coordinates.
The system expects that requesting the object space bounding box will be fast.
t | The time to retrieve the bounding box. |
inode | The node to calculate the bounding box for. |
vp | An interface pointer that may be used to call methods associated with the viewports. |
box | Contains the returned bounding box. |
Reimplemented from BaseObject.
This method computes the bounding box in the objects local coordinates or the optional space defined by tm.
Note: If you are looking for a precise bounding box, use this method and pass in the node's object TM (INode::GetObjectTM()) as the matrix.
t | The time to compute the box. |
box | A reference to a box the result is stored in. |
tm | This is an alternate coordinate system used to compute the box. If the tm is not NULL this matrix should be used in the computation of the result. |
useSel | If TRUE, the bounding box of selected sub-elements should be computed; otherwise the entire object should be used. |
Reimplemented from Object.
CoreExport void ApplyForceField | ( | ForceField * | ff | ) | [virtual] |
This method is called to add the force field object passed to the list of force field objects operating on this particle system.
ff | Points to an instance of a ForceField object. |
void SimpleParticle::ApplyForceField(ForceField *ff) { fields.Append(1,&ff); }
Implements ParticleObject.
CoreExport BOOL ApplyCollisionObject | ( | CollisionObject * | co | ) | [virtual] |
This method is called to add the collision object passed to the list of collision objects operating on this particle system.
co | Points to an instance of a collision object. |
BOOL SimpleParticle::ApplyCollisionObject(CollisionObject *co) { cobjs.Append(1,&co); return TRUE; }
Implements ParticleObject.
CoreExport TimeValue ParticleAge | ( | TimeValue | t, |
int | i | ||
) | [virtual] |
Returns the age of the specified particle -- the length of time it has been 'alive'.
The Particle Age texture map and the Particle Motion Blur texture map use this method.
t | Specifies the time to compute the particle age. |
i | The index of the particle. |
Reimplemented from ParticleObject.
CoreExport void SetParticlePosition | ( | TimeValue | t, |
int | i, | ||
Point3 | pos | ||
) |
CoreExport void SetParticleVelocity | ( | TimeValue | t, |
int | i, | ||
Point3 | vel | ||
) |
CoreExport void SetParticleAge | ( | TimeValue | t, |
int | i, | ||
TimeValue | age | ||
) |
void GetClassName | ( | MSTR & | s | ) | [inline, virtual] |
Retrieves the name of the plugin class.
This name is usually used internally for debugging purposes. For Material plug-ins this method is used to put up the material "type" name in the Material Editor.
s | Reference to a string filled in with the name of the plugin class |
Reimplemented from ReferenceTarget.
{s = GetObjectName();}
int NumSubs | ( | ) | [inline, virtual] |
Reimplemented from Animatable.
{return 1;}
Animatable* SubAnim | ( | int | i | ) | [inline, virtual] |
i | This is the index of the sub-anim to return. |
Reimplemented from Animatable.
{ return (Animatable*)pblock; }
CoreExport MSTR SubAnimName | ( | int | i | ) | [virtual] |
i | The index of the parameter name to return |
Reimplemented from Animatable.
CoreExport void* GetInterface | ( | ULONG | id | ) | [virtual] |
Inherited from Animatable.
Returns a pointer to the interface.
id | - The id of the interface. |
Reimplemented from Object.
int NumRefs | ( | ) | [inline, virtual] |
Returns the total number of references this ReferenceMaker can hold.
The plugin implements this method to indicate the total number of of references it can make. This includes all references whether they are NULL (inactive) or non-NULL (active) at the time when this method is called. A plugin can hold a variable number of references, thus the return value of this method is not to be cached and reused by client code.
Reimplemented from ReferenceMaker.
{return 1;}
RefTargetHandle GetReference | ( | int | i | ) | [inline, virtual] |
Returns the 'i-th' reference.
The plugin implements this method to return its 'i-th' reference. The plug-in simply keeps track of its references using an integer index for each one. This method is normally called by the system.
i | - The index of the reference to retrieve. Valid values are from 0 to NumRefs()-1. |
Reimplemented from ReferenceMaker.
{return (RefTargetHandle)pblock;}
virtual void SetReference | ( | int | i, |
RefTargetHandle | rtarg | ||
) | [inline, protected, virtual] |
Stores a ReferenceTarget as its 'i-th' reference`.
The plugin implements this method to store the reference handle passed to it as its 'i-th' reference. In its implementation of this method, the plugin should simply assign the reference handle passed in as a parameter to the member variable that holds the 'i-th' reference. Other reference handling methods such as ReferenceMaker::DeleteReference(), or ReferenceMaker::ReplaceReference() should not be called from within this method. The plugin itself or other plugins should not call this method directly. The system will call this method when a new reference is created or an existing one is replaced by calling ReferenceMaker::ReplaceReference().
i | - The index of the reference to store. Valid values are from 0 to NumRefs()-1. |
rtarg | - The reference handle to store. |
Reimplemented from ReferenceMaker.
{pblock=(IParamBlock*)rtarg;}
CoreExport RefResult NotifyRefChanged | ( | Interval | changeInt, |
RefTargetHandle | hTarget, | ||
PartID & | partID, | ||
RefMessage | message | ||
) | [virtual] |
Receives and responds to messages.
A plugin which makes references must implement a method to receive and respond to messages broadcast by its dependents. This is done by implementing NotifyRefChanged(). The plugin developer usually implements this method as a switch statement where each case is one of the messages the plugin needs to respond to. The Method StdNotifyRefChanged calls this, which can change the partID to new value. If it doesn't depend on the particular message& partID, it should return REF_DONTCARE.
changeInt | - This is the interval of time over which the message is active. Currently, all plug-ins will receive FOREVER for this interval. |
hTarget | - This is the handle of the reference target the message was sent by. The reference maker uses this handle to know specifically which reference target sent the message. |
partID | - This contains information specific to the message passed in. Some messages don't use the partID at all. See the section List of Reference Messages for more information about the meaning of the partID for some common messages. |
message | - The message parameters passed into this method is the specific message which needs to be handled. |
Implements ReferenceMaker.
virtual void UpdateParticles | ( | TimeValue | t, |
INode * | node | ||
) | [pure virtual] |
virtual void BuildEmitter | ( | TimeValue | t, |
Mesh & | amesh | ||
) | [pure virtual] |
virtual Interval GetValidity | ( | TimeValue | t | ) | [pure virtual] |
virtual MarkerType GetMarkerType | ( | ) | [inline, virtual] |
{return POINT_MRKR;}
virtual BOOL OKtoDisplay | ( | TimeValue | t | ) | [inline, virtual] |
{return TRUE;}
virtual BOOL EmitterVisible | ( | ) | [inline, virtual] |
{return TRUE;}
virtual void InvalidateUI | ( | ) | [inline, virtual] |
{}
virtual ParamDimension* GetParameterDim | ( | int | pbIndex | ) | [inline, virtual] |
{return defaultDim;}
virtual MSTR GetParameterName | ( | int | pbIndex | ) | [inline, virtual] |
{return MSTR(_M("Parameter"));}
TimeValue tvalid |
CoreExport SimpleParticle*
editOb [static] |