Rhino C++ API  7.26
Public Member Functions | Public Attributes | Friends | List of all members
CRhinoTextureMappingTable Class Reference

#include <rhinoSdkTexture.h>

Inheritance diagram for CRhinoTextureMappingTable:
ON_SimpleArray< CRhinoTextureMapping * >

Public Member Functions

int AddTextureMapping (const ON_TextureMapping &texture_mapping, bool bReference=false)
const ON_TextureCoordinatesCachedTextureCoordinates (const ON_MappingChannel *mc, const ON_Mesh &mesh) const
const ON_TextureCoordinatesCachedTextureCoordinates (const ON_UUID &plugin_id, int mapping_channel_id, const ON_3dmObjectAttributes &object_attributes, const ON_Mesh &mesh) const
int CreateTextureMapping (const ON_TextureMapping &mapping, unsigned int worksession_ref_model_sn, unsigned int linked_idef_sn)
bool DeleteTextureMapping (int texture_mapping_index)
CRhinoDocDocument () const
int FindTextureMapping (const ON_MappingChannel *mapping_channel, bool bIgnoreDeleted=true) const
int FindTextureMapping (const wchar_t *texture_mapping_name, bool bIgnoreDeleted=true) const
int FindTextureMapping (ON_UUID texture_mapping_id, bool bIgnoreDeleted=true) const
bool GetTextureMapping (const ON_MappingChannel *mapping_channel, ON_TextureMapping &mapping) const
bool GetTextureMapping (const ON_UUID &texture_mapping_id, ON_TextureMapping &mapping) const
bool InTextureMappingTable (const ON_TextureMapping *texture_mapping) const
bool IsValidTextureMappingTableIndex (int texture_mapping_index) const
void ListTable (ON_TextLog &text_log, unsigned int level_of_detail) const
bool ModifyTextureMapping (const ON_TextureMapping &texture_mapping, int texture_mapping_index, bool bQuiet=false)
const CRhinoTextureMappingoperator[] (int texture_mapping_index) const
void SetRemapIndex (int, int)
void Sort (int(*compare)(const CRhinoTextureMapping *, const CRhinoTextureMapping *, void *), int(*cull)(const CRhinoTextureMapping *, void *), void *p=0)
const class CRhinoDocTableReferenceTableReference () const
int TextureMappingCount () const
bool UndeleteTextureMapping (int texture_mapping_index)
bool UndoModifyTextureMapping (int texture_mapping_index, unsigned int ur_sn)

Public Attributes

const CRhinoTextureMappingDefaultTextureMapping


class CRhinoDoc

Member Function Documentation

◆ AddTextureMapping()

int CRhinoTextureMappingTable::AddTextureMapping ( const ON_TextureMapping texture_mapping,
bool  bReference = false 

Description: Adds a new texture_mapping to the texture_mapping table.

Parameters: texture_mapping - [in] definition of new texture_mapping. The information in texture_mapping is copied. If texture_mapping.TextureMappingName() is empty the a unique name of the form "TextureMapping 01" will be automatically created.

bReference - [in] TRUE if this texture_mapping is a reference texture_mapping. Reference texture_mappings are not saved in files.

Returns: @untitled table >=0 index of new texture_mapping -1 texture_mapping not added because a texture_mapping with that name already exists.

Remarks: In some cases, calling AddTextureMapping() can cause the memory references returned by operator[] and CurrentTextureMapping() to become invalid.

◆ CachedTextureCoordinates() [1/2]

const ON_TextureCoordinates* CRhinoTextureMappingTable::CachedTextureCoordinates ( const ON_MappingChannel mc,
const ON_Mesh mesh 
) const

◆ CachedTextureCoordinates() [2/2]

const ON_TextureCoordinates* CRhinoTextureMappingTable::CachedTextureCoordinates ( const ON_UUID plugin_id,
int  mapping_channel_id,
const ON_3dmObjectAttributes object_attributes,
const ON_Mesh mesh 
) const

Description: Get cached texture coordinates off a mesh. If the coordinates do not exist but can be calculated, they are calculated and returned.

Parameters: plugin_id - [in] mapping_channel_id - [in] object_attributes - [in] mc - [in] mesh - [in]

Returns: A pointer to the texture coordinates, if they exist.

◆ CreateTextureMapping()

int CRhinoTextureMappingTable::CreateTextureMapping ( const ON_TextureMapping mapping,
unsigned int  worksession_ref_model_sn,
unsigned int  linked_idef_sn 

Description: Basic tool used to create a new texturemapping with specified definition to the texturemapping table. The AddTextureMapping() functions all use CreateTextureMapping() when a new texturemapping needs to be added to the texturemapping table.

Parameters: texturemapping - [in] definition of new texturemapping. The information in texturemapping is copied. If texturemapping.TextureMappingName() is empty the a unique name of the form "TextureMapping 01" will be automatically created.

worksession_ref_model_sn - [in] 0: texturemapping is not a reference layer 1: texturemapping is a reference texturemapping but not part of a worksession reference file 2-1000: reserved for future use >1000: worksession reference file serial number

linked_idef_sn - [in] 0: texturemapping is not from a liked instance definition 1-1000: reserved for future use >1000: texturemapping instance defintion serial number

Returns: @untitled table >=0 index of new texturemapping -1 texturemapping not added because a texturemapping with that name already exists.

◆ DeleteTextureMapping()

bool CRhinoTextureMappingTable::DeleteTextureMapping ( int  texture_mapping_index)

◆ Document()

CRhinoDoc& CRhinoTextureMappingTable::Document ( ) const

Description: TextureMapping tables store the list of texture_mappings in a Rhino document.

Returns: CRhinoDocument that owns this texture_mapping table.

◆ FindTextureMapping() [1/3]

int CRhinoTextureMappingTable::FindTextureMapping ( const ON_MappingChannel mapping_channel,
bool  bIgnoreDeleted = true 
) const

◆ FindTextureMapping() [2/3]

int CRhinoTextureMappingTable::FindTextureMapping ( const wchar_t *  texture_mapping_name,
bool  bIgnoreDeleted = true 
) const

◆ FindTextureMapping() [3/3]

int CRhinoTextureMappingTable::FindTextureMapping ( ON_UUID  texture_mapping_id,
bool  bIgnoreDeleted = true 
) const

◆ GetTextureMapping() [1/2]

bool CRhinoTextureMappingTable::GetTextureMapping ( const ON_MappingChannel mapping_channel,
ON_TextureMapping mapping 
) const

Description: Get a texture mapping from a mapping ref. Parameters: mapping_channel - [in] texture_mapping_id - [in] mapping - [out] Return True if the mapping was found.

◆ GetTextureMapping() [2/2]

bool CRhinoTextureMappingTable::GetTextureMapping ( const ON_UUID texture_mapping_id,
ON_TextureMapping mapping 
) const

◆ InTextureMappingTable()

bool CRhinoTextureMappingTable::InTextureMappingTable ( const ON_TextureMapping texture_mapping) const

Returns: true The texture mapping is an element in this texture mapping table.

◆ IsValidTextureMappingTableIndex()

bool CRhinoTextureMappingTable::IsValidTextureMappingTableIndex ( int  texture_mapping_index) const

Returns: true The texture_mapping_index is a valid index of a texture mapping element in this texture mapping table.

◆ ListTable()

void CRhinoTextureMappingTable::ListTable ( ON_TextLog text_log,
unsigned int  level_of_detail 
) const

◆ ModifyTextureMapping()

bool CRhinoTextureMappingTable::ModifyTextureMapping ( const ON_TextureMapping texture_mapping,
int  texture_mapping_index,
bool  bQuiet = false 

Description: Modify texture_mapping settings

Parameters: texture_mapping - [in] new settings. This information is copied. texture_mapping_index - [in] zero based index of texture_mapping to set. This must be in the range 0 <= texture_mapping_index < TextureMappingCount(). bQuiet - [in] if TRUE, then no message boxes pop up to explain failures.

Returns: TRUE if successful. FALSE if texture_mapping_index is out of range or the settings attempt to lock or hide the current texture_mapping.

◆ operator[]()

const CRhinoTextureMapping& CRhinoTextureMappingTable::operator[] ( int  texture_mapping_index) const

Description: Conceptually, the texture_mapping table is an array of TextureMappingCount() texture_mappings. The operator[] can be used to get individual texture_mappings. A texture_mapping is either active or deleted and this state is reported by CRhinoTextureMapping::IsDeleted().

Parameters: texture_mapping_index - zero based array index or -1 for the default rendering texture_mapping.

Returns: Refererence to the texture_mapping. If texture_mapping_index is out of range, the current texture_mapping is returned. Note that this reference may become invalid after AddTextureMapping() is called.

◆ SetRemapIndex()

void CRhinoTextureMappingTable::SetRemapIndex ( int  ,

Description: Gets an array of pointers to texturemappings whose value of CRhinoTextureMapping.m_sort_index != -1. The returned list is sorted by the value of CRhinoTextureMapping.m_sort_index.

Parameters: sorted_list - [out] this array is returned with length <= TextureMappingCount() and is sorted by the values of CRhinoTextureMapping::m_sort_index.

bIgnoreDeleted - [in] true means don't include deleted texturemappings.

bIgnoreReferenced - [in] true means don't include referenced texturemappings. A "referenced" texturemapping is one from a worksession reference model or a linked instance definition model.

Remarks: Use Sort() to set the values of m_sort_index. void GetSortedList( ON_SimpleArray< const CRhinoTextureMapping* >& sorted_list, bool bIgnoreDeleted, bool bIgnoreReferenced ) const;

◆ Sort()

void CRhinoTextureMappingTable::Sort ( int(*)(const CRhinoTextureMapping *, const CRhinoTextureMapping *, void *)  compare,
int(*)(const CRhinoTextureMapping *, void *)  cull,
void *  p = 0 

Description: Use this to set CRhinoTextureMapping::m_sort_index so that the values of m_sort_index run from 0 to TextureMappingCount()-1 and compare(texture_mapping_table[i],texture_mapping_table[j]) < 0 ) implies texture_mapping_table[i].m_sort_index < texture_mapping_table[j].m_sort_index.

Parameters: compare - [in] compare function with prototype int compare(const CRhinoTextureMapping* arg1,const CRhinoTextureMapping* arg2,void* p). that returns <0 if arg1<arg2, 0 if arg1=arg2, and >0 if arg1>arg2. cull - [in] optional filter function with prototype int cull(const CRhinoTextureMapping* arg,void* p). that returns TRUE if the texture_mapping should be ignored when sorting. TextureMappings that are ignored are not included in the list returned by GetSortedList(). Pass 0 if you do not need to cull the list. p - [in] pointer passed as last argument to compare() and cull().

Remarks: After calling Sort(), you can repeatedly call GetSortedList() to get a sorted list of CRhinoTextureMapping pointers. Sort() and GetSortedList() do not modify the order or persistent information in the texture_mapping table. They are intended to be used to get sorted lists of texture_mappings for dialogs, etc.

◆ TableReference()

const class CRhinoDocTableReference& CRhinoTextureMappingTable::TableReference ( ) const

◆ TextureMappingCount()

int CRhinoTextureMappingTable::TextureMappingCount ( ) const

Returns: Number of texture_mappings in the texture_mapping table, including deleted texture_mappings.

◆ UndeleteTextureMapping()

bool CRhinoTextureMappingTable::UndeleteTextureMapping ( int  texture_mapping_index)

◆ UndoModifyTextureMapping()

bool CRhinoTextureMappingTable::UndoModifyTextureMapping ( int  texture_mapping_index,
unsigned int  ur_sn 

Description: If the texture_mapping has been modified and the modification can be undone, then UndoModifyTextureMapping() will restore the texture_mapping to its previous state.

Returns: True if this texture_mapping had been modified and the modifications were undone.

See Also: CRhinoTextureMapping::IsModified.

Friends And Related Function Documentation

◆ CRhinoDoc

friend class CRhinoDoc

Member Data Documentation

◆ DefaultTextureMapping

const CRhinoTextureMapping& CRhinoTextureMappingTable::DefaultTextureMapping