C++ API Reference
MFnLightDataAttribute Class Reference

Light data attribute function set. More...

#include <MFnLightDataAttribute.h>

+ Inheritance diagram for MFnLightDataAttribute:

Public Member Functions

virtual MFn::Type type () const
 Function set type. More...
 
virtual ~MFnLightDataAttribute ()
 Destructor.
 
 MFnLightDataAttribute ()
 Default constructor.
 
 MFnLightDataAttribute (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
MObject create (const MString &fullName, const MString &briefName, const MObject &direction, const MObject &intensity, const MObject &ambient, const MObject &diffuse, const MObject &specular, const MObject &shadowFraciton, const MObject &preShadowIntensity, const MObject &blindData, MStatus *ReturnStatus=NULL)
 Creates a LightData attribute object. More...
 
MStatus getDefault (float &defDirectionX, float &defDirectionY, float &defDirectionZ, float &defIntensityR, float &defIntensityG, float &defIntensityB, bool &defAmbient, bool &defDiffuse, bool &defSpecular, float &defShadowFraction, float &defPreShadowIntensity, void *&defBlindData)
 Gets the default value for the attribute. More...
 
MStatus setDefault (float defDirectionX, float defDirectionY, float defDirectionZ, float defIntensityR, float defIntensityG, float defIntensityB, bool defAmbient, bool defDiffuse, bool defSpecular, float defShadowFraction, float defPreShadowIntensity, void *defBlindData)
 Sets the default value for the attribute. More...
 
MObject child (unsigned int index, MStatus *returnStatus)
 Gets a pointer to one of the child attributes. More...
 
 MFnLightDataAttribute (const MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
- Public Member Functions inherited from MFnAttribute
virtual ~MFnAttribute ()
 Destructor.
 
 MFnAttribute ()
 Default constructor.
 
 MFnAttribute (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor. More...
 
bool isReadable (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is readable. More...
 
bool isWritable (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is writable. More...
 
bool isConnectable (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute accepts dependency graph connections. More...
 
bool isStorable (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is to be stored when the node is saved to a file. More...
 
bool isCached (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is cached locally in the node's data block. More...
 
bool isArray (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute supports an array of data. More...
 
bool indexMatters (MStatus *ReturnStatus=NULL) const
 Determines whether the user must specify an index when connecting to this attribute, or whether the next available index can be used. More...
 
bool isKeyable (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is keyable. More...
 
bool isChannelBoxFlagSet (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute has its channel box flag set. More...
 
bool isHidden (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is to hidden from the UI. More...
 
bool isUsedAsColor (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is to be presented as a color in the UI. More...
 
bool isIndeterminant (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is indeterminant. More...
 
bool isRenderSource (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is a render source. More...
 
bool isDynamic (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is a dynamic attribute. More...
 
bool isExtension (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is an extension attribute. More...
 
bool isWorldSpace (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is worldspace. More...
 
bool isAffectsWorldSpace (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute affects worldspace. More...
 
bool isUsedAsFilename (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is to be used as a filename. More...
 
bool affectsAppearance (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute affects the appearance of the object when rendering in the viewport. More...
 
bool isProxyAttribute (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute is a proxy attribute. More...
 
DisconnectBehavior disconnectBehavior (MStatus *ReturnStatus=NULL) const
 Returns the behavior of this attribute when it is disconnected. More...
 
bool usesArrayDataBuilder (MStatus *ReturnStatus=NULL) const
 Returns true if this attribute uses an array data builder. More...
 
bool internal (MStatus *ReturnStatus=NULL) const
 Returns true if a node has internal member data representing this attribute. More...
 
MStatus setReadable (bool state)
 Sets whether this attribute should be readable. More...
 
MStatus setWritable (bool state)
 Sets whether this attribute should be writable. More...
 
MStatus setConnectable (bool state)
 Sets whether this attribute should allow dependency graph connections. More...
 
MStatus setStorable (bool state)
 Sets whether this attribute should be storable. More...
 
MStatus setCached (bool state)
 Sets whether the data for this attribute is cached locally in the node's data block. More...
 
MStatus setArray (bool state)
 Sets whether this attribute should have an array of data. More...
 
MStatus setIndexMatters (bool state)
 If the attribute is an array, then this method specifies whether to force the user to specify an index when connecting to this attribute, or to use the next available index. More...
 
MStatus setKeyable (bool state)
 Sets whether this attribute should accept keyframe data. More...
 
MStatus setChannelBox (bool state)
 Sets whether this attribute should appear in the channel box when the node is selected. More...
 
MStatus setHidden (bool state)
 Sets whether this attribute should be hidden from the UI. More...
 
MStatus setUsedAsColor (bool state)
 Sets whether this attribute should be presented as a color in the UI. More...
 
MStatus setIndeterminant (bool state)
 Sets whether this attribute is indeterminant. More...
 
MStatus setRenderSource (bool state)
 Sets whether this attribute should be used as a render source attribute. More...
 
MStatus setWorldSpace (bool state)
 Sets whether this attribute should be treated as worldspace. More...
 
MStatus setAffectsWorldSpace (bool state)
 Sets whether this attribute should affect worldspace. More...
 
MStatus setUsedAsFilename (bool state)
 Sets whether this attribute should be presented as a filename in the UI. More...
 
MStatus setAffectsAppearance (bool state)
 Sets whether this attribute affects the appearance of the object when rendering in the viewport. More...
 
MStatus setProxyAttribute (bool state)
 Sets whether this attribute is a proxy attribute. More...
 
MStatus setDisconnectBehavior (DisconnectBehavior behavior)
 Sets the disconnection behavior for this attribute. More...
 
MStatus setUsesArrayDataBuilder (bool state)
 Sets whether this attribute uses an array data builder. More...
 
MStatus setInternal (bool state)
 The function controls an attribute's data storage. More...
 
MStatus setNiceNameOverride (const MString &localizedName)
 Sets the localized string which should be used for this attribute in the UI. More...
 
bool acceptsAttribute (const MFnAttribute &attr, MStatus *ReturnStatus=NULL) const
 Returns true if this attribute can accept a connection with the given attribute. More...
 
bool accepts (MFnData::Type type, MStatus *ReturnStatus=NULL) const
 Returns true if this attribute can accept a connection of the given type. More...
 
bool accepts (const MTypeId &id, MStatus *ReturnStatus=NULL) const
 Returns true if this attribute can accept a connection of the given type. More...
 
MObject parent (MStatus *ReturnStatus=NULL) const
 Get the parent of this attribute, if it has one. More...
 
MString name (MStatus *ReturnStatus=NULL) const
 Returns the long name of the attribute. More...
 
MString shortName (MStatus *ReturnStatus=NULL) const
 Returns the short name of the attribute. More...
 
MString getAddAttrCmd (bool useLongName=false, MStatus *status=NULL) const
 Returns a string containing the addAttr command which would be required to recreate the attribute on a node. More...
 
MStatus addToCategory (const MString &category)
 Add the attribute to the named category. More...
 
MStatus removeFromCategory (const MString &category)
 Remove the attribute from the named category. More...
 
bool hasCategory (const MString &category) const
 Check to see if the attribute belongs to the named category. More...
 
MStatus getCategories (MStringArray &ReturnStatus) const
 Get all of the categories to which this attribute belongs. More...
 
 MFnAttribute (const MObject &object, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT. More...
 
- Public Member Functions inherited from MFnBase
virtual ~MFnBase ()
 Class Destructor. More...
 
bool hasObj (MFn::Type) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
bool hasObj (const MObject &) const
 Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system. More...
 
MObject object (MStatus *ReturnStatus=nullptr) const
 Returns the MObject that is attached to the Function Set. More...
 
virtual MStatus setObject (MObject &object)
 Attaches the Function Set to the specified Maya Object. More...
 
virtual MStatus setObject (const MObject &object)
 NO SCRIPT SUPPORT. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnAttribute
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MFnBase
static const char * className ()
 Returns the name of this class. More...
 
static const char * typeString (MFn::Type)
 Introduced in 2020.0 More...
 
static bool isValid (MFn::Type)
 Introduced in 2020.0 More...
 

Additional Inherited Members

- Public Types inherited from MFnAttribute
enum  DisconnectBehavior { kDelete, kReset, kNothing }
 Attribute behaviour on disconnect. More...
 

Detailed Description

Light data attribute function set.

Function object for LightData attributes. A LightData attribute describes a single light source, giving its direction and intensity, as well as specifying whether or not it contributes to the ambient, diffuse, and specular components of the shading model.

Examples:
anisotropicShader/anisotropicShader.cpp, backfillShader/backfillShader.cpp, lambertShader/lambertShader.cpp, lightShader/lightShader.cpp, onbShader/onbShader.cpp, phongShader/phongShader.cpp, and shadowMatteShader/shadowMatteShader.cpp.

Constructor & Destructor Documentation

MFnLightDataAttribute ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
  • MS::kSuccess if the function set is successfully attached
  • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject
MFnLightDataAttribute ( const MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
  • MS::kSuccess if the function set is successfully attached
  • MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

Member Function Documentation

MFn::Type type ( ) const
virtual

Function set type.

Return the class type : MFn::kLightDataAttribute.

Returns
the class type.

Reimplemented from MFnAttribute.

OPENMAYA_MAJOR_NAMESPACE_OPEN const char * className ( )
static

Returns the name of this class.

Return the class name : "MFnLightDataAttribute".

Returns
Name of this class.
MObject create ( const MString fullName,
const MString briefName,
const MObject direction,
const MObject intensity,
const MObject ambient,
const MObject diffuse,
const MObject specular,
const MObject shadowFraction,
const MObject preShadowIntensity,
const MObject blindData,
MStatus ReturnStatus = NULL 
)

Creates a LightData attribute object.

The create method needs to be called on a per node basis. That means if you want to create and add the same attribute to multiple nodes, you need to call the create method for each node to get a unique MObject back. If you call create just once and add the attribute to multiple nodes, Maya will encounter a fatal error.

Parameters
[in]fullNameThe full name of the attribute
[in]briefNameThe brief name of the attribute
[in]directionThe 3Float child attribute that will represent the light direction
[in]intensityThe 3Float child attibute that will represent the light intensity
[in]ambientThe Boolean child attribute that specifies whether or not the light contributes to the ambient component of the shading model
[in]diffuseThe Boolean child attribute that specifies whether or not the light contributes to the diffuse component of the shading model
[in]specularThe Boolean child attribute that specifies whether or not the light contributes to the specular component of the shading model
[in]shadowFractionThe float attribute that will represent the percentage of the light that is in shadow with respect to the intersection point. 0 means the light is total visible to the intersection point and 1 means the light is total invisible to the intersection point.
[in]preShadowIntensityThe float attribute that will represetnt the light intensity without shadow consideration
[in]blindDataAttribute to hold the light's blind data.
[out]ReturnStatusStatus code for the operation.
Returns
The newly created LightData attribute object.
Status Codes:
  • MS::kInvalidParameter One of the specified child attribute pointers was NULL or was of the wrong type
  • MS::kSuccess The attribute object was successfully created.
Examples:
anisotropicShader/anisotropicShader.cpp, backfillShader/backfillShader.cpp, lambertShader/lambertShader.cpp, lightShader/lightShader.cpp, onbShader/onbShader.cpp, phongShader/phongShader.cpp, and shadowMatteShader/shadowMatteShader.cpp.
MStatus getDefault ( float &  defDirectionX,
float &  defDirectionY,
float &  defDirectionZ,
float &  defIntensityR,
float &  defIntensityG,
float &  defIntensityB,
bool &  defAmbient,
bool &  defDiffuse,
bool &  defSpecular,
float &  defShadowFraction,
float &  defPreShadowIntensity,
void *&  defBlindData 
)

Gets the default value for the attribute.

Parameters
[out]defDirectionXreturns the default x component of light direction
[out]defDirectionYreturns the default y component of light direction
[out]defDirectionZreturns the default z component of light direction
[out]defIntensityRreturns the default red component of light intensity
[out]defIntensityGreturns the default green component of light intensity
[out]defIntensityBreturns the default blue component of light intensity
[out]defAmbientreturns the default ambient flag
[out]defDiffusereturns the default diffuse flag
[out]defSpecularreturns the default specular flag
[out]defShadowFractionreturns the default shadow fraction flag
[out]defPreShadowIntensityreturns the default pre shadow intensity flag
[out]defBlindDatareturns the default blind data
Returns
Status flag
Status Codes:
  • MS::kSuccess The defaults were successfully queried
MStatus setDefault ( float  defDirectionX,
float  defDirectionY,
float  defDirectionZ,
float  defIntensityR,
float  defIntensityG,
float  defIntensityB,
bool  defAmbient,
bool  defDiffuse,
bool  defSpecular,
float  defShadowFraction,
float  defPreShadowIntensity,
void *  defBlindData 
)

Sets the default value for the attribute.

Parameters
[in]defDirectionXDefault x component of light direction
[in]defDirectionYDefault y component of light direction
[in]defDirectionZDefault z component of light direction
[in]defIntensityRDefault red component of light intensity
[in]defIntensityGDefault green component of light intensity
[in]defIntensityBDefault blue component of light intensity
[in]defAmbientDefault ambient flag
[in]defDiffuseDefault diffuse flag
[in]defSpecularDefault specular flag
[in]defShadowFractionDefault shadow fraction flag
[in]defPreShadowIntensityDefault pre shadow intensity flag
[in]defBlindDataDefault blind data
Returns
Status flag
Status Codes:
  • MS::kSuccess The defaults were successfully set
Examples:
anisotropicShader/anisotropicShader.cpp, backfillShader/backfillShader.cpp, lambertShader/lambertShader.cpp, lightShader/lightShader.cpp, onbShader/onbShader.cpp, phongShader/phongShader.cpp, and shadowMatteShader/shadowMatteShader.cpp.
MObject child ( unsigned int  index,
MStatus ReturnStatus 
)

Gets a pointer to one of the child attributes.

Parameters
[in]indexSpecifies which child is desired:
  • 0 = direction
  • 1 = intensity
  • 2 = ambient flag
  • 3 = diffuse flag
  • 4 = specular flag
  • 5 = shadow fraction flag
  • 6 = pre shadow intensity flag
  • 7 = blind data flag
[out]ReturnStatusStatus code for the operation
Returns
A pointer to the desired child attribute
Status Codes:
  • MS::kSuccess The child was successfully retrieved
  • MS::kFailure The child was not successfully retrieved

The documentation for this class was generated from the following files: