Public Member Functions
Override Class Reference

Detailed Description

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"); 
See also:
Parameter::GetOverridenObject, Parameter::GetOverridingObject, Parameter::GetOriginalValue
Since:
7.0
Example:
This example demonstrates how to create and access override parameters
        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>

Inheritance diagram for Override:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Override ()
 ~Override ()
 Override (const CRef &in_ref)
 Override (const Override &in_obj)
bool IsA (siClassID in_ClassID) const
siClassID GetClassID () const
Overrideoperator= (const Override &in_obj)
Overrideoperator= (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

Constructor & Destructor Documentation

Override ( )

Default constructor.

~Override ( )

Default destructor.

Override ( const CRef in_ref)

Constructor.

Parameters:
in_refconstant reference object.
Override ( const Override in_obj)

Copy constructor.

Parameters:
in_objconstant class object.

Member Function Documentation

bool IsA ( siClassID  in_ClassID) const [virtual]

Returns true if a given class type is compatible with this API class.

Parameters:
in_ClassIDclass type.
Returns:
true if the class is compatible, false otherwise.

Reimplemented from Property.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from Property.

Override& operator= ( const Override in_obj)

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:
in_objconstant class object.
Returns:
The new Override object.
Override& operator= ( const CRef in_ref)

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:
in_refconstant class object.
Returns:
The new Override object.

Reimplemented from Property.

CParameterRefArray GetParameterEntries ( ) const

Returns the overriding parameters of this override property.

Returns:
Array of overriding parameters.
Example:
This example demonstrates how to loop over override parameters
        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
CRef AddParameterEntry ( const Parameter in_param)

Adds a new entry to override the input parameter and returns the new overriding parameter.

Note:
Adding an entry to the override doesn't activate the override parameter automatically, you must first set its value with the SetValue command. Parameter::PutValue will not activate the override parameter.
Parameters:
in_paramThe parameter to override.
Returns:
The new overriding parameter.
Empty CRef on failure.
See also:
Override::RemoveParameterEntry, Override::RemoveAllEntries
Example:
This example demonstrates how to add a parameter entry to an 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;
        }
CStatus RemoveParameterEntry ( const Parameter in_param)

Removes the entry corresponding to the input parameter object.

Parameters:
in_paramThe parameter to remove. You can pass either the overriding Parameter that represents the entry or the overridden parameter.
Returns:
CStatus::OK Success
CStatus::Fail Failure
See also:
Override::AddParameterEntry, Override::RemoveAllEntries
Example:
This example demonstrates how to remove an entry from an 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() ) );

        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.

Returns:
CStatus::OK Success
CStatus::Fail Failure
See also:
Override::RemoveParameterEntry, Override::AddParameterEntry
Example:
This example demonstrates how to remove all entries from an 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

Returns the list of shaders nested under this Override.

Returns:
CRefArray of references to the nested Shader objects.
Since:
7.0
CRefArray GetAllImageClips ( ) const

Returns the list of image clips nested under this Override.

Returns:
CRefArray of references to the nested ImageClip2 objects.
See also:
Light::GetAllImageClips, Material::GetAllImageClips, Pass:GetAllImageClips, Shader::GetAllImageClips, Camera::GetAllImageClips
Since:
7.0

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