Public Member Functions
CICEAttributeDataArray2D< T > Class Template Reference

Detailed Description

template<class T>
class XSI::CICEAttributeDataArray2D< T >

This template class encapsulates ICEAttribute data as a 2D array. CICEAttributeDataArray2D objects are read-only and can be filled with the methods supplied with the ICEAttribute class. CICEAttributeDataArray2D is zero-based and can be one of the following types:

All types are associated to specific ICEAttribute 2D types. Therefore, you need to declare the right array object type that matches the ICEAttribute data type you want to access. Otherwise a runtime error will occur and the returned array will be empty.

See also:
ICEAttribute::GetDataArray2D, ICEAttribute::GetDataArray2DChunk, Type Definitions for CICEAttributeDataArray2D
Since:
7.0
Example:
This example demonstrates how to iterate over the EnvelopeWeightsPerDeformer ClusterProperty attribute data on en envelope.
        using namespace XSI;

        X3DObject cone = CreatePrim( L"Cone", L"MeshSurface", L"", L"");
        Create2DSkeleton( 2.95, 3.34, -0.33, 4.73, 0.0, 0.0, -5.71, 0, 0, 4, CValue(""), CValue(""));
        AppendBone( L"eff", 3.70, -3.02, 0.30, L"");

        XSI::siConstructionMode mode = siConstructionModeModeling;
        ApplyFlexEnv( L"cone;bone,bone1,eff", true, mode );
        SelectObj( L"cone.polymsh.cls.EnvelopWeightCls.Envelope_Weights", L"", L"" );

        // Make sure to generate the data first
        cone.GetActivePrimitive().GetGeometry(0);

        Application xsi;
        ProjectItem envProp = xsi.GetSelection()[0];

        ICEAttribute attr = envProp.GetICEAttributeFromName( L"EnvelopeWeightsPerDeformer" );

        CICEAttributeDataArray2DFloat weight2D;
        attr.GetDataArray2D( weight2D );

        for( ULONG i=0; i<weight2D.GetCount( ); i++ )
        {
            CICEAttributeDataArray< float > weights;
            weight2D.GetSubArray( i, weights );
            for( ULONG j=0; j<weights.GetCount( ); j++ )
            {
                xsi.LogMessage( CString( weights[ j ] ) );
            }
        }

        // Helpers
        CValue CreatePrim( const CString& in_presetobj, const CString& in_geometrytype, const CString& in_name, const CString& in_parent )
        {
            CValueArray args(4);
            CValue retval;
            args[0]= in_presetobj;
            args[1]= in_geometrytype;
            args[2]= in_name;
            args[3]= in_parent;

            Application app;
            app.ExecuteCommand( L"CreatePrim", args, retval );
            return retval;
        }

        CValue Create2DSkeleton( const CValue& in_rx, const CValue& in_ry, const CValue& in_rz, const CValue& in_ex, const CValue& in_ey, const CValue& in_ez, const CValue& in_nx, const CValue& in_ny, const CValue& in_nz, const CValue& in_viewtype,  CValue& out_bone,  CValue& out_effector )
        {
            CValueArray args(12);
            CValue retval;

            args[0]= in_rx;
            args[1]= in_ry;
            args[2]= in_rz;
            args[3]= in_ex;
            args[4]= in_ey;
            args[5]= in_ez;
            args[6]= in_nx;
            args[7]= in_ny;
            args[8]= in_nz;
            args[9]= in_viewtype;

            Application app;
            app.ExecuteCommand( L"Create2DSkeleton", args, retval );

            out_bone = args[10];
            out_effector = args[11];
            return retval;
        }

        CValue AppendBone( const CValue&  in_inputobjs, const CValue& in_ex, const CValue& in_ey, const CValue& in_ez, bool in_pin )
        {
            CValueArray args(5);
            CValue retval;

            args[0]= in_inputobjs;
            args[1]= in_ex;
            args[2]= in_ey;
            args[3]= in_ez;
            args[4]= in_pin;

            Application app;
            app.ExecuteCommand( L"AppendBone", args, retval );

            return retval;
        }

        CValue ApplyFlexEnv( const CValue&  in_connectionset, bool in_assignnewdeformers,  XSI::siConstructionMode & io_constructionmode )
        {
            CValueArray args(3);
            CValue retval;

            args[0]= in_connectionset;
            args[1]= in_assignnewdeformers;
            args[2]= io_constructionmode;

            Application app;
            app.ExecuteCommand( L"ApplyFlexEnv", args, retval );

            io_constructionmode = (XSI::siConstructionMode)(LONG)args[2];
            return retval;
        }

        void SelectObj( const CValue&  in_selectionlist, const CString& in_hierarchylevel, bool in_checkobjectselectability )
        {
            CValueArray args(3);
            CValue retval;
            args[0]= in_selectionlist;
            args[1]= in_hierarchylevel;
            args[2]= in_checkobjectselectability;

            Application app;

            CStatus st = app.ExecuteCommand( L"SelectObj", args, retval );
            return;
        }

#include <xsi_iceattributedataarray2D.h>

Inheritance diagram for CICEAttributeDataArray2D< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  CICEAttributeDataArray2D ()
  ~CICEAttributeDataArray2D ()
CStatus  GetSubArray (ULONG in_index, CICEAttributeDataArray< T > &out_dataArray) const

Constructor & Destructor Documentation

Constructor.

~CICEAttributeDataArray2D ( ) [inline]

Destructor.


Member Function Documentation

CStatus GetSubArray ( ULONG  in_index,
CICEAttributeDataArray< T > &  out_dataArray 
) const [inline]

Accessor to the encapsulated array. This operator is called when reading the data so the return value is read-only.

Parameters:
in_index Index in the array. The index must be smaller than the number of elements in the array, otherwise the results are unpredictable.
out_dataArray A read-only reference to a CICEAttributeDataArray<T> object at a specific index.
Returns:
CStatus::OK Success
CStatus::InvalidArgument If in_index or out_dataArray is invalid.

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