MPxClientDeviceNode Class Reference

#include <MPxClientDeviceNode.h>

Class Description

Base class for client device creation.

MPxClientDeviceNode is an extension of MPxThreadedDevice node, and is intended for creating maya devices that act as clients. An example of this will be a Maya device that listens for animation data that is sent from another application.

See MPxThreadedDevice node for details on how to use the memory queue system

Plug-ins should create the MPxClientDeviceNode with a kCustomClient parameter.

This class contains the serverName and deviceName attributes. If these attributes are changed, the node will restart the thread so that processing will continue with the new settings.

NOTE: This class relies on the idle event queue to perform the node attribute updating. As a result, it will not work in Maya batch mode.

+ Examples:
+ Inheritance diagram for MPxClientDeviceNode:

Public Types

enum  ClientType { kUser, kInternal }
 Defines the type client server. More...
 
- Public Types inherited from MPxNode
enum  Type {
  kDependNode, kLocatorNode, kDeformerNode, kManipContainer,
  kSurfaceShape, kFieldNode, kEmitterNode, kSpringNode,
  kIkSolverNode, kHardwareShader, kHwShaderNode, kTransformNode,
  kObjectSet, kFluidEmitterNode, kImagePlaneNode, kParticleAttributeMapperNode,
  kCameraSetNode, kConstraintNode, kManipulatorNode, kMotionPathNode,
  kClientDeviceNode, kThreadedDeviceNode, kAssembly, kSkinCluster,
  kGeometryFilter, kBlendShape, kLast
}
 Defines the type of node. More...
 
enum  SchedulingType {
  kParallel, kSerial, kGloballySerial, kUntrusted,
  kDefaultScheduling = kSerial
}
 Defines the degree of parallelism of a node. More...
 

Public Member Functions

 MPxClientDeviceNode (ClientType typ=kUser)
 Constructor. More...
 
virtual ~MPxClientDeviceNode ()
 Class destructor.
 
virtual MPxNode::Type type () const
 Returns the type of node that this is. More...
 
ClientType clientType ()
 Returns the client type of this node. More...
 
virtual void threadHandler (const char *serverName, const char *deviceName)
 This method should be overridden in user defined nodes rather than the parameterless version that exists in the base class. More...
 
- Public Member Functions inherited from MPxThreadedDeviceNode
 MPxThreadedDeviceNode ()
 Constructor. More...
 
virtual ~MPxThreadedDeviceNode ()
 Class destructor.
 
virtual void threadHandler ()
 This method should be overridden in user defined nodes. More...
 
virtual void threadShutdownHandler ()
 This method should be overridden in user defined nodes. More...
 
bool isLive ()
 Returns the true if the node is live.
 
bool isDone ()
 Returns the true if the node has finished running.
 
MStatus setDone (bool done)
 This method is used to set done state of the thread. More...
 
MStatus beginThreadLoop ()
 This method should be called at the beginning of the loop in the secondary thread. More...
 
MStatus endThreadLoop ()
 This method should be called at the end of the loop in the secondary thread. More...
 
MStatus createMemoryPools (int nCount, int nElements, long nSize)
 This method should be called from the post constructor to create the memory buffers required. More...
 
MStatus destroyMemoryPools ()
 This method should be called to destroy the memory pools. More...
 
MStatus acquireDataStorage (MCharBuffer &buffer)
 This method is used to acquire a pointer to a block of storage that was allocated by the createMemoryPools() method. More...
 
MStatus pushThreadData (MCharBuffer &buffer)
 This method is used to push the block of storage onto the internal queue. More...
 
MStatus popThreadData (MCharBuffer &buffer)
 This method is used to pop the block of storage from the internal queue. More...
 
long threadDataCount ()
 This method returns the number of pieces of thread data that are currently in the node's queue. More...
 
MStatus releaseDataStorage (MCharBuffer &buffer)
 After popThreadData() is called, the pointer should be released so that it can be used again. More...
 
MStatus setRefreshOutputAttributes (const MObjectArray &attributeList)
 This method is used to set the list of output attributes which will be marked dirty by the secondary thread. More...
 
- Public Member Functions inherited from MPxNode
 MPxNode ()
 Constructor. More...
 
virtual ~MPxNode ()
 Destructor.
 
virtual void postConstructor ()
 Post constructor. More...
 
virtual MStatus compute (const MPlug &plug, MDataBlock &dataBlock)
 This method should be overridden in user defined nodes. More...
 
virtual bool getInternalValueInContext (const MPlug &plug, MDataHandle &dataHandle, MDGContext &ctx)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool setInternalValueInContext (const MPlug &plug, const MDataHandle &dataHandle, MDGContext &ctx)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool getInternalValue (const MPlug &plug, MDataHandle &dataHandle)
 This method is obsolete. More...
 
virtual bool setInternalValue (const MPlug &plug, const MDataHandle &dataHandle)
 This method is obsolete. More...
 
virtual int internalArrayCount (const MPlug &plug, const MDGContext &ctx) const
 This method is overridden by nodes that have internal array attributes which are not stored in Maya's datablock. More...
 
virtual void copyInternalData (MPxNode *)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual MStatus legalConnection (const MPlug &plug, const MPlug &otherPlug, bool asSrc, bool &isLegal) const
 This method allows you to check for legal connections being made to attributes of this node. More...
 
virtual MStatus legalDisconnection (const MPlug &plug, const MPlug &otherPlug, bool asSrc, bool &isLegal) const
 This method allows you to check for legal disconnections being made to attributes of this node. More...
 
virtual MStatus setDependentsDirty (const MPlug &plug, MPlugArray &plugArray)
 This method can be overridden in user defined nodes to specify which plugs should be set dirty based upon an input plug {plugBeingDirtied} which Maya is marking dirty. More...
 
virtual MStatus preEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode)
 Prepare a node's internal state for threaded evaluation. More...
 
virtual MStatus postEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode, PostEvaluationType evalType)
 Clean up node's internal state after threaded evaluation. More...
 
virtual SchedulingType schedulingType () const
 When overridden this method controls the degree of parallelism supported by the node during threaded evaluation. More...
 
virtual MStatus connectionMade (const MPlug &plug, const MPlug &otherPlug, bool asSrc)
 This method gets called when connections are made to attributes of this node. More...
 
virtual MStatus connectionBroken (const MPlug &plug, const MPlug &otherPlug, bool asSrc)
 This method gets called when connections are broken with attributes of this node. More...
 
virtual MStatus dependsOn (const MPlug &plug, const MPlug &otherPlug, bool &depends) const
 This method may be overridden by the user defined node. More...
 
virtual bool isPassiveOutput (const MPlug &plug) const
 This method may be overridden by the user defined node if it wants to provide output attributes which do not prevent value modifications to the destination attribute. More...
 
virtual MStatus shouldSave (const MPlug &plug, bool &isSaving)
 This method may be overridden by the user defined node. More...
 
virtual MPlug passThroughToOne (const MPlug &plug) const
 This method may be overridden by nodes that have a one-to-one relationship between an input attribute and a corresponding output attribute. More...
 
virtual bool passThroughToMany (const MPlug &plug, MPlugArray &plugArray) const
 This method is overridden by nodes that want to control the traversal behavior of some Maya search algorithms which traverse the history/future of shape nodes looking for directly related nodes. More...
 
virtual bool isAbstractClass () const
 Override this class to return true if this node is an abstract node. More...
 
virtual MStringArray getFilesToArchive (bool shortName=false, bool unresolvedName=false, bool markCouldBeImageSequence=false) const
 Use this method to return all external files used by this node. More...
 
virtual void getExternalContent (MExternalContentInfoTable &table) const
 Returns the external content (files) that this node depends on. More...
 
bool addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
bool setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table)
 Sets content info in the specified attribute from the table. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &table)
 Changes the location of external content in batch. More...
 
virtual MTypeId typeId () const
 Returns the TYPEID of this node. More...
 
virtual MString typeName () const
 Returns the type name of this node. More...
 
virtual MString name () const
 Returns the name of this particular instance of this class. More...
 
virtual MObject thisMObject () const
 Returns the MObject associated with this user defined node. More...
 
virtual MStatus setExistWithoutInConnections (bool flag)
 This method specifies whether or not the node can exist without input connections. More...
 
virtual bool existWithoutInConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without input connections. More...
 
virtual MStatus setExistWithoutOutConnections (bool flag)
 This method specifies whether or not the node can exist without output connections. More...
 
virtual bool existWithoutOutConnections (MStatus *ReturnStatus=NULL) const
 Determines whether or not this node can exist without output connections. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MPxThreadedDeviceNode
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MPxNode
static MStatus addAttribute (const MObject &attr)
 This method adds a new attribute to a user defined node type during the type's initialization. More...
 
static MStatus inheritAttributesFrom (const MString &parentClassName)
 This method allows a class of plugin node to inherit all of the attributes of a second class of plugin node. More...
 
static MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected)
 This method specifies that a particular input attribute affects a specific output attribute. More...
 
static const char * className ()
 Returns the name of this class. More...
 

Static Public Attributes

static MObject serverName
 Server.
 
static MObject deviceName
 Device.
 
- Static Public Attributes inherited from MPxThreadedDeviceNode
static MObject output
 Output data, generic attribute.
 
static MObject live
 Makes node live, boolean attribute.
 
static MObject frameRate
 Capture frame rate, double attribute.
 
- Static Public Attributes inherited from MPxNode
static MObject message
 message attribute
 
static MObject isHistoricallyInteresting
 is historically interesting attribute
 
static MObject caching
 caching attribute
 
static MObject state
 state attribute
 
static MObject frozen
 frozen attribute
 

Additional Inherited Members

- Protected Member Functions inherited from MPxNode
virtual MDataBlock forceCache (MDGContext &ctx=MDGContext::fsNormal)
 USE _forceCache() IN SCRIPT. More...
 
virtual void setMPSafe (bool flag)
 USE _setMPSafe() IN SCRIPT. More...
 
virtual MStatus setDoNotWrite (bool flag)
 USE _setDoNotWrite() IN SCRIPT. More...
 
virtual bool doNotWrite (MStatus *ReturnStatus=NULL) const
 USE _doNotWrite() IN SCRIPT. More...
 

Member Enumeration Documentation

enum ClientType

Defines the type client server.

Enumerator
kUser 

Custom client implemented in a plug-in.

kInternal 

Autodesk specific.

Constructor & Destructor Documentation

Constructor.

The constructor should never call any methods from MPxNode or make any calls that require the existence of the MObject associated with the user defined node. The postConstructor method should be used to do any initialization of this kind.

For example, the postConstructor method would be used to call: setRefreshOutputAttributes()

Parameters
[in]typespecify what type of client will be implemented

Member Function Documentation

MPxNode::Type type ( ) const
virtual

Returns the type of node that this is.

This is used to differentiate user defined nodes that are derived off different MPx base classes.

It is not necessary to override this method.

Returns
Type of the node

Reimplemented from MPxThreadedDeviceNode.

Returns the client type of this node.

Returns
Client type of the node
void threadHandler ( const char *  serverName,
const char *  deviceName 
)
virtual

This method should be overridden in user defined nodes rather than the parameterless version that exists in the base class.

Thread management( creation/destruction/shutdown ) will be handled by Maya. This method will be called when the thread has been created. In a typical implementation, the thread handler will implement a loop for reading information from an external device.

Parameters
[in]serverNamecurrent server name
[in]deviceNamecurrent device name
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files:
  • MPxClientDeviceNode.h
  • MPxClientDeviceNode.cpp