|
SketchUp C API
|
References a material object. More...
#include <SketchUpAPI/model/material.h>
Inherits SUEntityRef.
Related Functions | |
(Note that these are not member functions.) | |
| SUEntityRef | SUMaterialToEntity (SUMaterialRef material) |
| Converts from an SUMaterialRef to an SUEntityRef. This is essentially an upcast operation. More... | |
| SUMaterialRef | SUMaterialFromEntity (SUEntityRef entity) |
| Converts from an SUEntityRef to an SUMaterialRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUMaterialRef. More... | |
| enum SUResult | SUMaterialCreate (SUMaterialRef *material) |
| Creates a material. More... | |
| enum SUResult | SUMaterialRelease (SUMaterialRef *material) |
| Releases a material and its resources. More... | |
| enum SUResult | SUMaterialSetName (SUMaterialRef material, const char *name) |
| Sets the name of a material object. More... | |
| enum SUResult | SUMaterialGetName (SUMaterialRef material, SUStringRef *name) |
| Retrieves the internal name of a material object. The internal name is the unprocessed identifier string stored with the material. More... | |
| enum SUResult | SUMaterialGetNameLegacyBehavior (SUMaterialRef material, SUStringRef *name) |
| Retrieves the name of a material object. This method was added for users who require the functionality of SUMaterialGetName() 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. More... | |
| enum SUResult | SUMaterialSetColor (SUMaterialRef material, const SUColor *color) |
| Sets the color of a material object. More... | |
| enum SUResult | SUMaterialGetColor (SUMaterialRef material, SUColor *color) |
| Retrieves the color value of a material object. More... | |
| enum SUResult | SUMaterialSetTexture (SUMaterialRef material, SUTextureRef texture) |
| Sets the texture of a material object. More... | |
| enum SUResult | SUMaterialGetTexture (SUMaterialRef material, SUTextureRef *texture) |
| Retrieves the texture of a material object. More... | |
| enum SUResult | SUMaterialGetOpacity (SUMaterialRef material, double *alpha) |
| Retrieves the alpha value (0.0 - 1.0) of a material object. More... | |
| enum SUResult | SUMaterialSetOpacity (SUMaterialRef material, double alpha) |
| Sets the alpha value of a material object. More... | |
| enum SUResult | SUMaterialGetUseOpacity (SUMaterialRef material, bool *use_opacity) |
| Retrieves the flag indicating whether alpha values are used from a material object. More... | |
| enum SUResult | SUMaterialSetUseOpacity (SUMaterialRef material, bool use_opacity) |
| Sets the flag indicating whether alpha values are used on a material object. More... | |
| enum SUResult | SUMaterialSetType (SUMaterialRef material, enum SUMaterialType type) |
| Sets the type of a material object. More... | |
| enum SUResult | SUMaterialGetType (SUMaterialRef material, enum SUMaterialType *type) |
| Retrieves the type of a material object. More... | |
| enum SUResult | SUMaterialIsDrawnTransparent (SUMaterialRef material, bool *transparency) |
| Retrieves the flag indicating whether the material is drawn with transparency. More... | |
| enum SUResult | SUMaterialGetOwnerType (SUMaterialRef material, enum SUMaterialOwnerType *type) |
| Retrieves the owner type of a material object. More... | |
| enum SUResult | SUMaterialSetColorizeType (SUMaterialRef material, enum SUMaterialColorizeType type) |
| Sets the colorization type of a material object. This is used when the material's color is set to a custom value. Call this function after calling SUMaterialSetColor as otherwise the colorize type will be reset. More... | |
| enum SUResult | SUMaterialGetColorizeType (SUMaterialRef material, enum SUMaterialColorizeType *type) |
| Retrieves the colorization type of a material object. More... | |
| enum SUResult | SUMaterialGetColorizeDeltas (SUMaterialRef material, double *hue, double *saturation, double *lightness) |
| The colorize_deltas method retrieves the HLS deltas for colorized materials. More... | |
| enum SUResult | SUMaterialWriteToFile (SUMaterialRef material, const char *file_path) |
| Writes a material to a SKM file. More... | |
| enum SUResult | SUMaterialGetHatchPattern (SUMaterialRef material, SUHatchPatternRef *hatch_pattern) |
| Retrieves the hatch pattern that fills the section cut of groups and component instances painted with this material. More... | |
| enum SUResult | SUMaterialSetHatchPattern (SUMaterialRef material, SUHatchPatternRef hatch_pattern) |
| Sets the hatch pattern that fills the section cut of groups and component instances painted with this material. More... | |
PBR Metallic Roughness Workflow | |
| enum SUResult | SUMaterialGetWorkflow (SUMaterialRef material, enum SUMaterialWorkflow *workflow) |
| Queries the workflow type of a material. More... | |
| enum SUResult | SUMaterialSetMetalnessEnabled (SUMaterialRef material, bool enable) |
| Enables metalness properties for the material. More... | |
| enum SUResult | SUMaterialIsMetalnessEnabled (SUMaterialRef material, bool *enabled) |
| Queries whether metalness properties are enabled for the material. More... | |
| enum SUResult | SUMaterialSetMetallicTexture (SUMaterialRef material, SUTextureRef texture) |
| Sets the metallic texture of a PBR material. More... | |
| enum SUResult | SUMaterialGetMetallicTexture (SUMaterialRef material, SUTextureRef *texture) |
| Retrieves the metallic texture of a material. More... | |
| enum SUResult | SUMaterialSetMetallicFactor (SUMaterialRef material, double factor) |
| Sets the metallic factor of a material. More... | |
| enum SUResult | SUMaterialGetMetallicFactor (SUMaterialRef material, double *factor) |
| Retrieves the metallic factor of a material. More... | |
| enum SUResult | SUMaterialSetRoughnessEnabled (SUMaterialRef material, bool enable) |
| Enables roughness properties for the material. More... | |
| enum SUResult | SUMaterialIsRoughnessEnabled (SUMaterialRef material, bool *enabled) |
| Queries whether roughness properties are enabled for the material. More... | |
| enum SUResult | SUMaterialSetRoughnessTexture (SUMaterialRef material, SUTextureRef texture) |
| Sets the roughness texture of a PBR material. More... | |
| enum SUResult | SUMaterialGetRoughnessTexture (SUMaterialRef material, SUTextureRef *texture) |
| Retrieves the roughness texture of a material. More... | |
| enum SUResult | SUMaterialSetRoughnessFactor (SUMaterialRef material, double factor) |
| Sets the roughness factor of a material. More... | |
| enum SUResult | SUMaterialGetRoughnessFactor (SUMaterialRef material, double *factor) |
| Retrieves the roughness factor of a material. More... | |
| enum SUResult | SUMaterialSetRoughnessTextureInverted (SUMaterialRef material, bool invert) |
| Sets the roughness texture inversion flag of a material. More... | |
| enum SUResult | SUMaterialIsRoughnessTextureInverted (SUMaterialRef material, bool *inverted) |
| Retrieves the roughness texture inversion flag of a material. More... | |
| enum SUResult | SUMaterialSetNormalEnabled (SUMaterialRef material, bool enable) |
| Enables normal map for the material. More... | |
| enum SUResult | SUMaterialIsNormalEnabled (SUMaterialRef material, bool *enabled) |
| Queries whether normal mapping is enabled for the material. More... | |
| enum SUResult | SUMaterialSetNormalTexture (SUMaterialRef material, SUTextureRef texture) |
| Sets the normal texture of a PBR material. More... | |
| enum SUResult | SUMaterialGetNormalTexture (SUMaterialRef material, SUTextureRef *texture) |
| Retrieves the normal texture of a material. More... | |
| enum SUResult | SUMaterialSetNormalScale (SUMaterialRef material, double scale) |
| Sets the normal scale of a material. More... | |
| enum SUResult | SUMaterialGetNormalScale (SUMaterialRef material, double *scale) |
| Retrieves the normal scale of a material. More... | |
| enum SUResult | SUMaterialSetNormalStyle (SUMaterialRef material, enum SUMaterialNormalMapStyle style) |
| Sets the normal mapping style of a material. More... | |
| enum SUResult | SUMaterialGetNormalStyle (SUMaterialRef material, enum SUMaterialNormalMapStyle *style) |
| Retrieves the normal mapping style of a material. More... | |
| enum SUResult | SUMaterialSetAOEnabled (SUMaterialRef material, bool enable) |
| Enables ambient occlusion map for the material. More... | |
| enum SUResult | SUMaterialIsAOEnabled (SUMaterialRef material, bool *enabled) |
| Queries whether ambient occlusion mapping is enabled for the material. More... | |
| enum SUResult | SUMaterialSetAOTexture (SUMaterialRef material, SUTextureRef texture) |
| Sets the ambient occlusion texture of a PBR material. More... | |
| enum SUResult | SUMaterialGetAOTexture (SUMaterialRef material, SUTextureRef *texture) |
| Retrieves the ambient occlusion texture of a material. More... | |
| enum SUResult | SUMaterialSetAOStrength (SUMaterialRef material, double strength) |
| Sets the ambient occlusion strength of a material. More... | |
| enum SUResult | SUMaterialGetAOStrength (SUMaterialRef material, double *strength) |
| Retrieves the ambient occlusion strength of a material. More... | |
Related Functions inherited from SUEntityRef | |
| enum SURefType | SUEntityGetType (SUEntityRef entity) |
| Returns the concrete type of the given entity. More... | |
| enum SUResult | SUEntityGetID (SUEntityRef entity, int32_t *entity_id) |
| Retrieves the id of the entity. More... | |
| enum SUResult | SUEntityGetPersistentID (SUEntityRef entity, int64_t *entity_pid) |
| Retrieves the persistent id of the entity. More... | |
| enum SUResult | SUEntityGetNumAttributeDictionaries (SUEntityRef entity, size_t *count) |
| Retrieves the number of attribute dictionaries of an entity. More... | |
| enum SUResult | SUEntityGetAttributeDictionaries (SUEntityRef entity, size_t len, SUAttributeDictionaryRef dictionaries[], size_t *count) |
| Retrieves the attribute dictionaries of an entity. More... | |
| enum SUResult | SUEntityAddAttributeDictionary (SUEntityRef entity, SUAttributeDictionaryRef dictionary) |
| Adds the attribute dictionary to an entity. The given dictionary object must not belong to another entity. In other words, each dictionary should be added to one entity only. More... | |
| enum SUResult | SUEntityGetAttributeDictionary (SUEntityRef entity, const char *name, SUAttributeDictionaryRef *dictionary) |
| Retrieves the attribute dictionary of an entity that has the given name. More... | |
| enum SUResult | SUEntityGetModel (SUEntityRef entity, SUModelRef *model) |
| Retrieves the model object associated with the entity. More... | |
| enum SUResult | SUEntityGetParentEntities (SUEntityRef entity, SUEntitiesRef *entities) |
| Retrieves the entities object which contains the entity. More... | |
References a material object.
|
related |
Creates a material.
If the material is not associated with any face, it must be deallocated with SUMaterialRelease().
| [out] | material | The material created. |
|
related |
Converts from an SUEntityRef to an SUMaterialRef. This is essentially a downcast operation so the given SUEntityRef must be convertible to an SUMaterialRef.
| [in] | entity | The given entity reference. |
|
related |
Retrieves the ambient occlusion strength of a material.
| [in] | material | The material object. |
| [out] | strength | Occlusion strength returned. |
material is not a valid objectstrength is NULL
|
related |
Retrieves the ambient occlusion texture of a material.
| [in] | material | The material object. |
| [out] | texture | The texture containing the occlusion information, if one exists. This texture should not be released via SUTextureRelease() since it is owned by the material. |
material is not a valid objecttexture is NULLmaterial does not have an AO texture
|
related |
Retrieves the color value of a material object.
| [in] | material | The material object. |
| [out] | color | The color value retrieved. |
|
related |
The colorize_deltas method retrieves the HLS deltas for colorized materials.
| [in] | material | The material object. |
| [out] | hue | The Hue delta. |
| [out] | saturation | The Saturation delta. |
| [out] | lightness | The Lightness delta. |
|
related |
Retrieves the colorization type of a material object.
| [in] | material | The material object. |
| [out] | type | The type retrieved. |
|
related |
Retrieves the hatch pattern that fills the section cut of groups and component instances painted with this material.
The returned hatch pattern is owned by the model and must not be released. A pattern assigned to the group or component instance itself takes precedence over its material's pattern, which in turn takes precedence over the section plane's pattern.
| [in] | material | The material object. |
| [out] | hatch_pattern | The hatch pattern retrieved. |
material is not a valid objecthatch_pattern is NULLmaterial has no hatch pattern assigned
|
related |
Retrieves the metallic factor of a material.
| [in] | material | The material object. |
| [out] | factor | The factor returned. |
material is not a valid objectfactor is NULL
|
related |
Retrieves the metallic texture of a material.
| [in] | material | The material object. |
| [out] | texture | The texture containing the metalness information, if one exists. This texture should not be released via SUTextureRelease() since it is owned by the material. |
material is not a valid objecttexture is NULLmaterial does not have a metalness texture
|
related |
Retrieves the internal name of a material object. The internal name is the unprocessed identifier string stored with the material.
| [in] | material | The material object. |
| [out] | name | The name retrieved. |
|
related |
Retrieves the name of a material object. This method was added for users who require the functionality of SUMaterialGetName() 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.
| [in] | material | The material object. |
| [out] | name | The name retrieved. |
|
related |
Retrieves the normal scale of a material.
| [in] | material | The material object. |
| [out] | scale | Normal scale returned. |
material is not a valid objectscale is NULL
|
related |
Retrieves the normal mapping style of a material.
| [in] | material | The material object. |
| [out] | style | Normal style returned. |
material is not a valid objectstyle is NULL
|
related |
Retrieves the normal texture of a material.
| [in] | material | The material object. |
| [out] | texture | The texture containing the normal information, if one exists. This texture should not be released via SUTextureRelease() since it is owned by the material. |
material is not a valid objecttexture is NULLmaterial does not have a normal texture
|
related |
Retrieves the alpha value (0.0 - 1.0) of a material object.
| [in] | material | The material object. |
| [out] | alpha | The alpha value retrieved. |
|
related |
Retrieves the owner type of a material object.
| [in] | material | The material object. |
| [out] | type | The type retrieved. |
|
related |
Retrieves the roughness factor of a material.
| [in] | material | The material object. |
| [out] | factor | The factor returned. |
material is not a valid objectfactor is NULL
|
related |
Retrieves the roughness texture of a material.
| [in] | material | The material object. |
| [out] | texture | The texture containing the roughness information, if one exists. This texture should not be released via SUTextureRelease() since it is owned by the material. |
material is not a valid objecttexture is NULLmaterial does not have a roughness texture
|
related |
Retrieves the texture of a material object.
| [in] | material | The material object. |
| [out] | texture | The texture object retrieved. This texture should not be released via SUTextureRelease() since it is owned by the material. |
|
related |
Retrieves the type of a material object.
| [in] | material | The material object. |
| [out] | type | The type retrieved. |
|
related |
Retrieves the flag indicating whether alpha values are used from a material object.
| [in] | material | The material object. |
| [out] | use_opacity | The flag retrieved. |
|
related |
Queries the workflow type of a material.
| [in] | material | The material object. |
| [out] | workflow | The returned workflow type. |
material is not a valid objectworkflow is NULL
|
related |
Queries whether ambient occlusion mapping is enabled for the material.
| [in] | material | The material object. |
| [out] | enabled | Whether occlusion mapping is enabled or not. |
material is not a valid objectenabled is NULL
|
related |
Retrieves the flag indicating whether the material is drawn with transparency.
| [in] | material | The material object. |
| [out] | transparency | The flag retrieved. |
|
related |
Queries whether metalness properties are enabled for the material.
| [in] | material | The material object. |
| [out] | enabled | Whether metalness is enabled or not. |
material is not a valid objectenabled is NULL
|
related |
Queries whether normal mapping is enabled for the material.
| [in] | material | The material object. |
| [out] | enabled | Whether normal mapping is enabled or not. |
material is not a valid objectenabled is NULL
|
related |
Queries whether roughness properties are enabled for the material.
| [in] | material | The material object. |
| [out] | enabled | Whether roughness is enabled or not. |
material is not a valid objectenabled is NULL
|
related |
Retrieves the roughness texture inversion flag of a material.
| [in] | material | The material object. |
| [out] | inverted | Whether the roughness texture values are inverted. |
material is not a valid objectinverted is NULL
|
related |
Releases a material and its resources.
The material must not be associated with a parent object such as a face.
| [in,out] | material | The material to be released. |
|
related |
Enables ambient occlusion map for the material.
| [in,out] | material | The material object. |
| [in] | enable | Whether to enable or disable. |
|
related |
Sets the ambient occlusion strength of a material.
| [in] | material | The material object. |
| [in] | strength | Strength to set. The valid range is [0.0, 1.0]. |
material is not a valid objectstrength is not within the valid range
|
related |
Sets the ambient occlusion texture of a PBR material.
| [in] | material | The material object. |
| [in] | texture | The texture containing the occlusion information. Should be an 8 bit per pixel (single channel) image. If an invalid texture reference is given (i.e. SU_INVALID), then any existing AO texture will be removed from the material, which will effectively disable AO mapping. |
material is not a valid objecttexture contains invalid occlusion data
|
related |
Sets the color of a material object.
| [in,out] | material | The material object. |
| [in] | color | The color value to set the material color. |
|
related |
Sets the colorization type of a material object. This is used when the material's color is set to a custom value. Call this function after calling SUMaterialSetColor as otherwise the colorize type will be reset.
| [in,out] | material | The material object. |
| [in] | type | The type to set. |
|
related |
Sets the hatch pattern that fills the section cut of groups and component instances painted with this material.
hatch_pattern must belong to the same model as material, so it must have been added with SUHatchPatternsAdd() first. Passing an invalid SUHatchPatternRef clears the assignment. Materials that belong to a layer or an image cannot be assigned a hatch pattern, but an existing assignment can still be cleared.
| [in] | material | The material object. |
| [in] | hatch_pattern | The hatch pattern to assign, or an invalid ref to clear the assignment. |
material is not a valid objectmaterial is not in a model, or if hatch_pattern is valid and material belongs to a layer or an image or hatch_pattern does not belong to material's model
|
related |
Sets the metallic factor of a material.
| [in,out] | material | The material object. |
| [in] | factor | Metallic factor to set. The valid range is [0.0, 1.0]. |
material is not a valid objectfactor is not within the valid range
|
related |
Sets the metallic texture of a PBR material.
| [in,out] | material | The material object. |
| [in] | texture | The texture containing the metalness information. Should be an 8 bit per pixel (single channel) image. If an invalid texture reference is given (i.e. SU_INVALID), then any existing metallic texture will be removed from the material. |
material is not a valid objecttexture contains invalid metalness data
|
related |
Enables metalness properties for the material.
| [in,out] | material | The material object. |
| [in] | enable | Whether to enable or disable. |
material is not a valid object
|
related |
Sets the name of a material object.
| [in,out] | material | The material object. |
| [in] | name | The name to set the material name. Assumed to be UTF-8 encoded. |
|
related |
Enables normal map for the material.
| [in,out] | material | The material object. |
| [in] | enable | Whether to enable or disable. |
|
related |
Sets the normal scale of a material.
| [in] | material | The material object. |
| [in] | scale | Normal scale to set. Should be >= 0.0 |
material is not a valid objectscale is not valid
|
related |
Sets the normal mapping style of a material.
| [in] | material | The material object. |
| [in] | style | Normal style to set. |
material is not a valid object
|
related |
Sets the normal texture of a PBR material.
| [in,out] | material | The material object. |
| [in] | texture | The texture containing the normal information. Should be an 24 bit per pixel (3 channel) image. If an invalid texture reference is given (i.e. SU_INVALID), then any existing normal texture will be removed from the material, which will effectively disable normal mapping. |
material is not a valid objecttexture contains invalid normal data
|
related |
Sets the alpha value of a material object.
| [in,out] | material | The material object. |
| [in] | alpha | The alpha value to set. Must be within range [0.0, 1.0]. |
|
related |
Enables roughness properties for the material.
| [in,out] | material | The material object. |
| [in] | enable | Whether to enable or disable. |
material is not a valid object
|
related |
Sets the roughness factor of a material.
| [in,out] | material | The material object. |
| [in] | factor | Roughness factor to set. The valid range is [0.0, 1.0]. |
material is not a valid objectfactor is not within the valid range
|
related |
Sets the roughness texture of a PBR material.
| [in,out] | material | The material object. |
| [in] | texture | The texture containing the roughness information. Should be an 8 bit per pixel (single channel) image. If an invalid texture reference is given (i.e. SU_INVALID), then any existing metallic texture will be removed from the material. |
material is not a valid objecttexture contains invalid roughness data
|
related |
Sets the roughness texture inversion flag of a material.
When enabled, the roughness texture values will be inverted (1.0 - value), effectively converting between roughness and smoothness/glossiness representations.
| [in,out] | material | The material object. |
| [in] | invert | Whether to invert the roughness texture values. |
material is not a valid object
|
related |
Sets the texture of a material object.
| [in,out] | material | The material object. |
| [in] | texture | The texture object to set the material texture. |
material or texture is not a valid objecttexture contains invalid image data
|
related |
Sets the type of a material object.
| [in,out] | material | The material object. |
| [in] | type | The type to set. |
|
related |
Sets the flag indicating whether alpha values are used on a material object.
| [in,out] | material | The material object. |
| [in] | use_opacity | The flag boolean value to set. |
|
related |
Converts from an SUMaterialRef to an SUEntityRef. This is essentially an upcast operation.
| [in] | material | The given material reference. |
|
related |
Writes a material to a SKM file.
| [in] | material | The material object. |
| [in] | file_path | The location to save the material to. Assumed to be UTF-8 encoded. |
material is not a valid objectmaterial is not attached to a modelfile_path is NULL
1.8.3.1