Public Member Functions
UVProperty Class Reference

## Detailed Description

UVProperty is a kind of ClusterProperty object used for storing and accessing the UV information of a cluster.

UVProperty supports a special API for pinning and unpinning UV components. Pinning acts like a lock. When UV components are pinned, they are not affected by operations performed on them. For instance, pinned UVs cannot be rotated or scaled in the Texture Editor.

Since:
  10.0 (2012)

Example:
  Demonstrates how to use the UVProperty pin/unpin API.

              using namespace XSI;
              Application app;
              Model root = app.GetActiveSceneRoot();

              X3DObject myCube;
              root.AddGeometry( "Cube", "MeshSurface", "", myCube );

              // install the texture support object
              CValueArray args(4);
              args[0] = CValue( CString("Image") );
              args[1] = CValue(myCube);
              args[2] = CValue((short)1);
              args[3] = CValue(false);

              CStatus st;
              CValue outArg;
              st = app.ExecuteCommand( "BlendInPresets", args, outArg );
              if ( st.GetCode() != CStatus::OK )
              {
                  app.LogMessage( "BlendInPresets failed" );
                  return;
              }

              args[0] = CValue(myCube);
              args[1] = CValue((LONG)siTxtUV);
              args[2] = CValue((LONG)siTxtDefaultSpherical);
              args[3] = CValue(CString(L"Texture_Support"));

              st = app.ExecuteCommand( "CreateTextureSupport", args, outArg );
              if ( st.GetCode() != CStatus::OK )
              {
                  app.LogMessage( "CreateTextureSupport failed" );
                  return;
              }

              // Get the uv property on the cube and set some components as pinned or unpinned
              PolygonMesh pm = myCube.GetActivePrimitive().GetGeometry();
              CGeometryAccessor ga = pm.GetGeometryAccessor();
              CRefArray uvs = ga.GetUVs();

              UVProperty uvprop( uvs[0] );

              // Pin some components
              CLongArray toPin(5);
              toPin[0] = 0;
              toPin[1] = 5;
              toPin[2] = 10;
              toPin[3] = 15;
              toPin[4] = 20;
              uvprop.PinComponents( toPin )

              // Use a CBitArray for a fast access to the pinned components
              XSI::CBitArray baComponents;
              uvprop.GetPinComponentArray( baComponents );

              LONG it = baComponents.GetIterator();
              LONG i = 0;
              while (baComponents.GetNextTrueBit(it))
              {
                  app.LogMessage( "Pinned component index = " + CString( it ) );
              }

              // Unpin all
              uvprop.UnPinAllComponents();

              uvprop.GetPinComponentArray( baComponents );

              app.LogMessage( "Number of Pinned components = " + CString( baComponents.GetTrueCount() ) );

          \code

`#include <xsi_uvproperty.h>`

Inheritance diagram for UVProperty:
[legend]

List of all members.

## Public Member Functions
| UVProperty ()
| ~UVProperty ()
| UVProperty (const CRef &in_ref)
| UVProperty (const UVProperty &in_obj)
bool | IsA (siClassID in_ClassID) const
siClassID | GetClassID () const
UVProperty & | operator= (const UVProperty &in_obj)
UVProperty & | operator= (const CRef &in_ref)
CStatus | PinAllComponents ()
CStatus | PinComponents (const CLongArray &in_componentArray)
CStatus | UnPinAllComponents ()
CStatus | UnPinComponents (const CLongArray &in_componentArray)
CStatus | GetPinComponentArray (CLongArray &out_componentArray) const
CStatus | GetPinComponentArray (CBitArray &out_baComponents) const

## Constructor & Destructor Documentation

UVProperty | ( |  | ) |

Default constructor.

~UVProperty | ( |  | ) |

Default destructor.

UVProperty | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

UVProperty | ( | const UVProperty & | in_obj | ) |

Copy constructor.

Parameters:

  in_obj | constant 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_ClassID | class type.

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

Reimplemented from ClusterProperty.

siClassID GetClassID | ( |  | ) | const `[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from ClusterProperty.

UVProperty& operator= | ( | const UVProperty & | 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_obj | constant class object.

Returns:
  The new UVProperty object.

UVProperty& 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_ref | constant class object.

Returns:
  The new UVProperty object.

Reimplemented from ClusterProperty.

CStatus PinAllComponents | ( |  | ) |

Mark all components referenced by this UV property as pinned.

Returns:
  CStatus::OK success.

CStatus PinComponents | ( | const CLongArray & | in_componentArray | ) |

Mark specific components referenced by this UV property as pinned.

Parameters:

  in_componentArray | Array of indices identifying the components to pin.

Returns:
  CStatus::OK success.
  CStatus::False Empty indice array..
  CStatus::InvalidArgument Indices are out of bound.

CStatus UnPinAllComponents | ( |  | ) |

Mark all components referenced by this UV property as unpinned.

Returns:
  CStatus::OK success.

CStatus UnPinComponents | ( | const CLongArray & | in_componentArray | ) |

Mark specific components referenced by this UV property as unpinned.

Parameters:

  in_componentArray | Array of indices identifying the components to unpin.

Returns:
  CStatus::OK success.
  CStatus::False Empty indice array..
  CStatus::InvalidArgument Indices are out of bound.

CStatus GetPinComponentArray | ( | CLongArray & | out_componentArray | ) | const

Returns an array of indices to identify the pinned components referenced by this UV property.

Returns:
  CStatus::OK Success.

CStatus GetPinComponentArray | ( | CBitArray & | out_baComponents | ) | const

Returns a bit array of indices to identify the pinned components referenced by this UV property. This is the preferred method for accessing the pin component indices of a UV property.

Returns:
  CStatus::OK Success.
  CStatus::False No pinned components.

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

- xsi_uvproperty.h