This class represents an Override override property. An override contains the parameters that are used for replacing an object's parameter with another value or a shader without removing the original object parameter.
Parameters whose values are overriden by another parameter's value are called 'overridden parameters' and the parameters stored in the override property whose values are used to override an overriden parameter are called 'overriding parameters'.
Override properties are created with SceneItem::AddProperty. You can get pointers to existing Override objects like any other property on an object:
Override overrideProp = pointLight.GetProperties().GetItem(L"MyOverride");
Application app; Model root = app.GetActiveSceneRoot(); // Create a light object Light pointLight; root.AddLight( L"Point", false, L"PointLight", pointLight ); pointLight.AddProperty( overridepreset, false, L"PointOverride" ); Override overrideProp = pointLight.GetProperties().GetItem(L"PointOverride"); Parameter posx = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posx"); // Set the original (overridden) parameter value posx.PutValue( 5.0 ); // Set the overriding value Parameter overridingPosx = overrideProp.AddParameterEntry( posx ); SetValue( overridingPosx.GetFullName(), CValue(-4.0), CValue(0) ); // Override the light shader color parameter Shader softLight = pointLight.GetShaders().GetItem( L"soft_light" ); Parameter softLightColor = softLight.GetParameters().GetItem(L"Color"); // Set the original value softLightColor.PutParameterValue( L"Red", 0.5 ); softLightColor.PutParameterValue( L"Blue", 0.5 ); // Set the overrding value Parameter overridingSoftLightColor = overrideProp.AddParameterEntry( softLightColor ); SIApplyShaderToCnxPoint( L"Shaders\\Texture\\Color_Channels\\RGBA_combine.Preset", CValue(overridingSoftLightColor.GetFullName()) ); // Log the overriding posx parameter values overridingPosx = overrideProp.GetParameterEntries().GetItem( L"posx" ); Parameter overridenPosx = overridingPosx.GetOverridenObject(); app.LogMessage( L"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" ); app.LogMessage( L"Overriding posx: " + overridingPosx.GetFullName() ); app.LogMessage( L"Overriding posx value: " + CString( overridingPosx.GetValue() ) ); app.LogMessage( L"Overriding posx original value: " + CString( overridingPosx.GetOriginalValue() ) ); app.LogMessage( L"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"); app.LogMessage( L"Overriden posx: " + overridenPosx.GetFullName() ); app.LogMessage( L"Overriden posx value: " + CString( overridenPosx.GetValue() ) ); app.LogMessage( L"Overriden posx original value: " + CString( overridenPosx.GetOriginalValue() ) ); // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriding posx: PointLight.PointOverride.posx // INFO : Overriding posx value: -4 // INFO : Overriding posx original value: 5 // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriden posx: PointLight.kine.local.posx // INFO : Overriden posx value: -4 // INFO : Overriden posx original value: 5 // Log the overriding color parameter values Parameter overridingColor = overrideProp.GetParameterEntries().GetItem( L"light-soft_light-color" ); Shader overridingColorSource = overridingColor.GetSource(); MATH::CColor4f overridingColorOriginalValue = overridingColor.GetOriginalValue(); app.LogMessage( L"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** "); app.LogMessage( L"Overriding color: " + overridingColorSource.GetFullName() ); app.LogMessage( L"Overriding color value: " + CString( overridingColorSource.GetParameterValue( L"red" ) ) +L":"+ CString( overridingColorSource.GetParameterValue( L"green" ) )+L":"+ CString( overridingColorSource.GetParameterValue( L"blue" ) )+L":"+ CString( overridingColorSource.GetParameterValue( L"alpha" ) ) ); app.LogMessage( L"Overriding color original value: " + CString( overridingColorOriginalValue.GetR( ) ) +L":"+ CString( overridingColorOriginalValue.GetG( ) )+L":"+ CString( overridingColorOriginalValue.GetB( ) )+L":"+ CString( overridingColorOriginalValue.GetA( ) ) ); // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ** // INFO : Overriding color: PointLight.PointOverride.RGBA_combine // INFO : Overriding color value: 1:1:1:1 // INFO : Overriding color original value: 0.5:1:0.5:0 Parameter overridenColor = overridingColor.GetOverridenObject(); MATH::CColor4f overridenColorValue = overridenColor.GetValue(); MATH::CColor4f overridenColorOriginalValue = overridenColor.GetOriginalValue(); app.LogMessage( L"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"); app.LogMessage( L"Overriden color: " + overridenColor.GetFullName() ); app.LogMessage( L"Overriden color value: " + CString( overridenColorValue.GetR( ) ) +L":"+ CString( overridenColorValue.GetG( ) )+L":"+ CString( overridenColorValue.GetB( ) )+L":"+ CString( overridenColorValue.GetA( ) ) ); app.LogMessage( L"Overriden color original value: " + CString( overridenColorOriginalValue.GetR( ) ) +L":"+ CString( overridenColorOriginalValue.GetG( ) )+L":"+ CString( overridenColorOriginalValue.GetB( ) )+L":"+ CString( overridenColorOriginalValue.GetA( ) ) ); // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriden color: PointLight.light.soft_light.color // INFO : Overriden color value: 0.5:1:0.5:0 // INFO : Overriden color original value: 0.5:1:0.5:0 CValue SetValue( const CString& in_target, const CValue& in_value, const CValue& in_time ) { CValueArray args(3); CValue retval; args[0]= in_target; args[1]= in_value; args[2]= in_time; Application app; app.ExecuteCommand( L"SetValue", args, retval ); return retval; } CValue SIApplyShaderToCnxPoint( const CValue& in_presetobj, const CValue& in_inputobjs ) { CValueArray args(4); CValue retval; LONG i(0); args[i++]= in_presetobj; args[i++]= in_inputobjs; args[i++]= L""; args[i++]= true; Application app; app.ExecuteCommand( L"SIApplyShaderToCnxPoint", args, retval ); return retval; }
#include <xsi_override.h>
Public Member Functions |
|
Override () | |
~Override () | |
Override (const CRef &in_ref) | |
Override (const Override &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
Override & | operator= (const Override &in_obj) |
Override & | operator= (const CRef &in_ref) |
CParameterRefArray | GetParameterEntries () const |
CRef | AddParameterEntry (const Parameter &in_param) |
CStatus | RemoveParameterEntry (const Parameter &in_param) |
CStatus | RemoveAllEntries () |
CRefArray | GetAllShaders () const |
CRefArray | GetAllImageClips () const |
Override | ( | ) |
Default constructor.
~Override | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from Property.
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
CParameterRefArray GetParameterEntries | ( | ) | const |
Returns the overriding parameters of this override property.
Application app; Model root = app.GetActiveSceneRoot(); // Create a light object Light pointLight; root.AddLight( L"Point", false, L"PointLight", pointLight ); // Add entries to an override Override overrideProp = pointLight.AddProperty( L"Override", false, L"PointOverride" ); Parameter posx = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posx"); Parameter posy = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posy"); Parameter posz = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posz"); overrideProp.AddParameterEntry( posx ); overrideProp.AddParameterEntry( posy ); overrideProp.AddParameterEntry( posz ); CParameterRefArray entries = overrideProp.GetParameterEntries(); for (ULONG i = 0; i< entries.GetCount(); i++) { Parameter paramEntry(entries[i]); app.LogMessage( L"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" ); app.LogMessage( L"Overriding: " + paramEntry.GetFullName() ); app.LogMessage( L"Overriding value: " + CString( paramEntry.GetValue() ) ); } // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriding: PointLight.PointOverride.posx // INFO : Overriding value: 0 // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriding: PointLight.PointOverride.posy // INFO : Overriding value: 0 // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriding: PointLight.PointOverride.posz // INFO : Overriding value: 0
Adds a new entry to override the input parameter and returns the new overriding parameter.
in_param | The parameter to override. |
Application app; Model root = app.GetActiveSceneRoot(); // Create a light object Light pointLight; root.AddLight( L"Point", false, L"PointLight", pointLight ); // Override the light posx parameter Override overrideProp = pointLight.AddProperty( L"Override", false, L"PointOverride" ); Parameter posx = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posx"); // Set the original value posx.PutValue( 5.0 ); // Set the overriding value Parameter overridingPosx = overrideProp.AddParameterEntry( posx ); SetValue( overridingPosx.GetFullName(), -4.0, 0 ); // Log values app.LogMessage( L"* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *" ); app.LogMessage( L"Overriding posx: " + overridingPosx.GetFullName() ); app.LogMessage( L"Overriding posx value: " + CString( overridingPosx.GetValue() ) ); app.LogMessage( L"Overriding posx original value: " + CString( overridingPosx.GetOriginalValue() ) ); // INFO : * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // INFO : Overriding posx: PointLight.PointOverride.posx // INFO : Overriding posx value: -4 // INFO : Overriding posx original value: 5 CValue SetValue( const CString& in_target, const CValue& in_value, const CValue& in_time ) { CValueArray args(3); CValue retval; args[0]= in_target; args[1]= in_value; args[2]= in_time; Application app; app.ExecuteCommand( L"SetValue", args, retval ); return retval; }
Removes the entry corresponding to the input parameter object.
in_param | The parameter to remove. You can pass either the overriding Parameter that represents the entry or the overridden parameter. |
Application app; Model root = app.GetActiveSceneRoot(); // Create a light object Light pointLight; root.AddLight( L"Point", false, L"PointLight", pointLight ); // Override the light posx parameter Override overrideProp = pointLight.AddProperty( L"Override", false, L"PointOverride" ); Parameter posx = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posx"); overrideProp.AddParameterEntry( posx ); // Override the light shader color parameter Shader softLight = pointLight.GetShaders().GetItem( L"soft_light" ); Parameter softLightColor = softLight.GetParameters().GetItem(L"Color"); Parameter overridingSoftLightColor = overrideProp.AddParameterEntry( softLightColor ); SIApplyShaderToCnxPoint( L"Shaders\\Texture\\Color_Channels\\RGBA_combine.Preset", CValue(overridingSoftLightColor) ); app.LogMessage( L"overrideProp.GetParameterEntries.Count: " + CString(overrideProp.GetParameterEntries().GetCount() ) ); Parameter overridingParam = overrideProp.GetParameterEntries()[ 0 ]; overrideProp.RemoveParameterEntry( overridingParam ); app.LogMessage( L"overrideProp.GetParameterEntries.Count: " + CString(overrideProp.GetParameterEntries().GetCount() ) ); // INFO : overrideProp.GetParameterEntries.Count: 2 // INFO : overrideProp.GetParameterEntries.Count: 1 CValue SIApplyShaderToCnxPoint( const CValue& in_presetobj, const CValue& in_inputobjs ) { CValueArray args(4); CValue retval; LONG i(0); args[i++]= in_presetobj; args[i++]= in_inputobjs; args[i++]= L""; args[i++]= true; Application app; app.ExecuteCommand( L"SIApplyShaderToCnxPoint", args, retval ); return retval; }
CStatus RemoveAllEntries | ( | ) |
Removes all entries from this override.
Application app; Model root = app.GetActiveSceneRoot(); // Create a light object Light pointLight; root.AddLight( L"Point", false, L"PointLight", pointLight ); // Override the light posx parameter Override overrideProp = pointLight.AddProperty( L"Override", false, L"PointOverride" ); Parameter posx = pointLight.GetKinematics().GetLocal().GetParameters().GetItem(L"posx"); overrideProp.AddParameterEntry( posx ); // Override the light shader color parameter Shader softLight = pointLight.GetShaders().GetItem( L"soft_light" ); Parameter softLightColor = softLight.GetParameters().GetItem(L"Color"); Parameter overridingSoftLightColor = overrideProp.AddParameterEntry( softLightColor ); SIApplyShaderToCnxPoint( L"Shaders\\Texture\\Color_Channels\\RGBA_combine.Preset", CValue(overridingSoftLightColor) ); app.LogMessage( L"overrideProp.GetParameterEntries.Count: " + CString(overrideProp.GetParameterEntries().GetCount() ) ); overrideProp.RemoveAllEntries( ); app.LogMessage( L"overrideProp.GetParameterEntries.Count: " + CString(overrideProp.GetParameterEntries().GetCount() ) ); // INFO : overrideProp.GetParameterEntries.Count: 2 // INFO : overrideProp.GetParameterEntries.Count: 0
CRefArray GetAllShaders | ( | ) | const |
CRefArray GetAllImageClips | ( | ) | const |
Returns the list of image clips nested under this Override.