SUAPI-CppWrapper
C++WrapperforSketchUpCAPI
Public Member Functions
CW::Material Class Reference
+ Inheritance diagram for CW::Material:

Public Member Functions

 Material (SUMaterialRef material_ref, bool attached=true)
 
 Material (const Material &other)
 
Materialoperator= (const Material &other)
 
 ~Material ()
 
SUMaterialRef ref () const
 
 operator SUMaterialRef () const
 
 operator SUMaterialRef * ()
 
bool operator! () const
 
Material copy () const
 
Color color () const
 
void color (const Color &color)
 
String name () const
 
void name (const String &string)
 
String display_name () const
 
double opacity () const
 
void opacity (const double alpha)
 
Texture texture () const
 
void texture (const Texture &texture)
 
SUMaterialType type () const
 
void type (const SUMaterialType &material_type)
 
bool use_alpha () const
 
void use_alpha (bool flag)
 
- Public Member Functions inherited from CW::Entity
 Entity ()
 Constructor representing a null objject.
 
 Entity (SUEntityRef entity, bool attached=true)
 Creates a new Entity object. More...
 
 Entity (const Entity &other, SUEntityRef entity_ref=SU_INVALID)
 Copy constructor with an optional parameter for the entity reference. More...
 
 ~Entity ()
 Destructor. More...
 
Entityoperator= (const Entity &other)
 Copy assignment operator.
 
 operator SUEntityRef () const
 
 operator SUEntityRef * ()
 
SUEntityRef ref () const
 
bool attached () const
 Returns true if the entity is attached to another object.
 
void attached (bool attach)
 Method lets the object know that it has been attached to a model. This is important as it will let the object know that it does not need to "release" the object. More...
 
std::vector< AttributeDictionaryattribute_dictionaries () const
 Returns the AttributeDictionaries collection attached to the entity. More...
 
AttributeDictionary attribute_dictionary (const std::string &name) const
 Returns an attribute dictionary object with a given name that is attached to an Entity. More...
 
bool add_dictionary (AttributeDictionary &dict)
 Adds the AttributeDictionary to the Entity. More...
 
bool copy_attributes_from (const Entity &entity)
 Copies attributes from another Entity object to this one. More...
 
bool is_valid () const
 Checks if the entity is valid. More...
 
bool operator! () const
 Returns true if this entity is not valid. Alias of !is_valid().
 
int32_t entityID () const
 Retrieve a unique ID assigned to an entity. More...
 
TypedValue get_attribute (const std::string &dict_name, const std::string &key, const TypedValue &default_value=TypedValue()) const
 Retrieves the value of an attribute in the entity's attribute dictionary. More...
 
TypedValue get_attribute (const AttributeDictionary &dict, const std::string &key, const TypedValue &default_value=TypedValue()) const
 Retrieves the value of an attribute in the entity's attribute dictionary. More...
 
bool set_attribute (const std::string &dict_name, const std::string &key, const TypedValue &value)
 Sets the value of an attribute in the given AttributeDictionary object. More...
 
bool set_attribute (AttributeDictionary &dict, const std::string &key, const TypedValue &value)
 Sets the value of an attribute in the given AttributeDictionary object. More...
 
enum SURefType entity_type () const
 Returns the type of the entity. See enum SURefType.
 
Model model () const
 
Entities parent () const
 
int64_t persistent_id () const
 

Additional Inherited Members

- Protected Attributes inherited from CW::Entity
SUEntityRef m_entity
 The C SUEntityRef that this class wraps.
 
bool m_attached
 Indicates whether the Entity has been attached to a model.
 

Detailed Description

Definition at line 43 of file Material.hpp.

Constructor & Destructor Documentation

CW::Material::Material ( const Material other)

Copy constructor

Definition at line 74 of file Material.cpp.

CW::Material::~Material ( )

Destructor

Definition at line 109 of file Material.cpp.

Member Function Documentation

Color CW::Material::color ( ) const

Returns the color of the material.

Definition at line 149 of file Material.cpp.

void CW::Material::color ( const Color color)

Sets the color of the material.

Definition at line 162 of file Material.cpp.

Material CW::Material::copy ( ) const

Returns a copy of the Material object, which is not attached to a model.

Definition at line 134 of file Material.cpp.

String CW::Material::display_name ( ) const

Retrieves the name of a material object. This method was added for users who require the functionality of Material.name() prior to SketchUp 2017, API 5.0. If the internal name is encased in square brackets, [], this method will return the name without brackets, otherwise the name will match the name retrieved by SUMaterialGetName.

Since
SketchUp 2017, API 5.0
Returns
string name of the material.

Definition at line 191 of file Material.cpp.

String CW::Material::name ( ) const

Returns the internal name of the material. The internal name is the unprocessed identifier string stored with the material.

Returns
string name of the material.

Definition at line 172 of file Material.cpp.

void CW::Material::name ( const String string)

Sets the name of the material.

Parameters
stringname of the material.

Definition at line 208 of file Material.cpp.

double CW::Material::opacity ( ) const

Returns the alpha value of the material.

Returns
opacity The alpha value within range [0.0, 1.0].

Definition at line 219 of file Material.cpp.

void CW::Material::opacity ( const double  alpha)

Sets the alpha value of the material.

Parameters
alphaThe alpha value within range [0.0, 1.0].

Definition at line 232 of file Material.cpp.

bool CW::Material::operator! ( ) const

Returns true if this is an invalid object, or if no material is set. An entitity with the default material would return false.

Definition at line 127 of file Material.cpp.

Material & CW::Material::operator= ( const Material other)

Copy assigment operator

Definition at line 88 of file Material.cpp.

Texture CW::Material::texture ( ) const

Returns the texture of the material

Definition at line 248 of file Material.cpp.

void CW::Material::texture ( const Texture texture)

Sets the texture of the material

Definition at line 261 of file Material.cpp.

SUMaterialType CW::Material::type ( ) const

Returns the type of the material

Definition at line 278 of file Material.cpp.

void CW::Material::type ( const SUMaterialType &  material_type)

Sets the texture of the material

Definition at line 289 of file Material.cpp.

bool CW::Material::use_alpha ( ) const

Returns whether the opacity value is used

Definition at line 298 of file Material.cpp.

void CW::Material::use_alpha ( bool  flag)

Sets whether the opacity value is used

Definition at line 309 of file Material.cpp.


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