Class: Sketchup::Material
| Relationships | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Entity
|
|
|
Instance Chain:
self,
Comparable,
Entity
|
|
| Inherits: |
Sketchup::Entity
|
Overview
The Material class represents a Texture or Color that can be applied to Drawingelements. It is most often applied to Faces.
You can pass any object that can be used as a material to a method that requires a material. Objects include actual Material, Color, and classes that can be converted to a color.
Constant Summary
-
COLORIZE_SHIFT =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 33
Constants
nil -
COLORIZE_TINT =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 34
Stub value.
nil -
MATERIAL_COLORIZED_TEXTURED =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 36
Stub value.
nil -
MATERIAL_SOLID =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 37
Stub value.
nil -
MATERIAL_TEXTURED =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 38
Stub value.
nil -
NORMAL_STYLE_DIRECTX =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 40
Stub value.
nil -
NORMAL_STYLE_OPENGL =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 41
Stub value.
nil -
OWNER_IMAGE =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 43
Stub value.
nil -
OWNER_LAYER =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 44
Stub value.
nil -
OWNER_MANAGER =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 45
Stub value.
nil -
WORKFLOW_CLASSIC =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 47
Stub value.
nil -
WORKFLOW_PBR_METALLIC_ROUGHNESS =
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Material.rb', line 48
Stub value.
nil
Instance Attribute Summary
-
#alpha ⇒ Float
rw
The #alpha method is used to get the opacity of the material.
-
#alpha=(alpha) ⇒ Float
rw
The #alpha= method is used to set the opacity of the material.
- #ao_enabled=(enabled) rw
- #ao_enabled? ⇒ Boolean rw
- #ao_strength ⇒ Float rw
- #ao_strength=(strenght) rw
- #ao_texture ⇒ Sketchup::Texture rw
- #ao_texture=(image_path) rw
-
#color ⇒ Sketchup::Color
rw
The #color method is used to retrieve the color of the material.
-
#color=(color)
rw
The #color= method is used to set the color of the material.
-
#colorize_type ⇒ Integer
rw
The #colorize_type method retrieves the type of colorization of the material.
-
#colorize_type=(type)
rw
The #colorize_type= method set the type of colorization of the material.
- #metallic_factor ⇒ Float rw
- #metallic_factor=(factor) rw
- #metallic_texture ⇒ Sketchup::Texture rw
- #metallic_texture=(image_path) rw
- #metalness_enabled=(enabled) rw
- #metalness_enabled? ⇒ Boolean rw
-
#name ⇒ String
rw
The #name method retrieves the name of the material.
-
#name=(str) ⇒ String
rw
The #name= method sets the name of the material.
- #normal_enabled=(enabled) rw
- #normal_enabled? ⇒ Boolean rw
- #normal_scale ⇒ Float rw
- #normal_scale=(scale) rw
- #normal_style ⇒ Integer rw
- #normal_style=(style) rw
- #normal_texture ⇒ Sketchup::Texture rw
- #normal_texture=(image_path) rw
- #roughness_enabled=(enabled) rw
- #roughness_enabled? ⇒ Boolean rw
- #roughness_factor ⇒ Float rw
- #roughness_factor=(factor) rw
- #roughness_texture ⇒ Sketchup::Texture rw
- #roughness_texture=(image_path) rw
-
#texture ⇒ Sketchup::Texture?
rw
The #texture method retrieves the texture of the material.
-
#texture=(filename)
rw
The #texture= method sets the texture for the material.
-
#use_alpha? ⇒ Boolean
readonly
The #use_alpha? method tells if the material uses transparency.
Entity - Inherited
Instance Method Summary
-
#<=>(material) ⇒ Integer
The #<=> method is used to compare two materials based on ##display_name.
-
#==(material) ⇒ Boolean
The #== method is used to test if two materials are the same.
-
#colorize_deltas ⇒ Array(Float, Float, Float)
The #colorize_deltas method retrieves the HLS delta for colorized materials.
-
#display_name ⇒ String
The #display_name method retrieves the name that is displayed within SketchUp for the material.
-
#materialType ⇒ Integer
The #materialType method retrieves the type of the material.
-
#owner_type ⇒ Integer
The #owner_type method is used to determine what owns the material.
-
#save_as(filename) ⇒ Boolean
The #save_as method is used to write a material to a SKM file.
- #workflow ⇒ Integer
-
#write_thumbnail(path, max_size) ⇒ Boolean?
The #write_thumbnail method writes a bitmap thumbnail to the given file name.
Entity - Inherited
| #add_observer | The add_observer method is used to add an observer to the current object. |
| #attribute_dictionaries | The attribute_dictionaries method is used to retrieve the |
| #attribute_dictionary | The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an |
| #delete_attribute | The |
| #entityID | The entityID method is used to retrieve a unique ID assigned to an entity. |
| #get_attribute | The |
| #inspect | The |
| #model | The model method is used to retrieve the model for the entity. |
| #parent | The parent method is used to retrieve the parent of the entity. |
| #persistent_id | The |
| #remove_observer | The remove_observer method is used to remove an observer from the current object. |
| #set_attribute | The set attribute is used to set the value of an attribute in an attribute dictionary with the given name. |
| #to_s | The |
| #typename | The typename method retrieves the type of the entity, which will be a string such as “Face”, “Edge”, or “Group”. |
Instance Attribute Details
#alpha ⇒ Float (rw)
The #alpha method is used to get the opacity of the material.
The value will be between 0.0 and 1.0. A value of 0.0 means that the material is completely transparent. A value of 1.0 means that the material is completely opaque.
#alpha=(alpha) ⇒ Float (rw)
The #alpha= method is used to set the opacity of the material.
The value must be between 0.0 and 1.0. A value of 0.0 means that the material is completely transparent. A value of 1.0 means that the material is completely opaque.
#ao_enabled=(enabled) (rw)
#ao_enabled? ⇒ Boolean (rw)
There is no setter for this property. Instead it’s dictated whether a #ao_texture is set.
#ao_strength ⇒ Float (rw)
#ao_strength=(strenght) (rw)
#ao_texture ⇒ Sketchup::Texture (rw)
#ao_texture=(image_path) (rw)
#ao_texture=(image_rep)
#ao_texture=(texture)
#color ⇒ Sketchup::Color (rw)
The #color method is used to retrieve the color of the material.
If it uses a colorized Texture, this will return the average color of the texture.
#color=(color) (rw)
The #color= method is used to set the color of the material.
If the material has a Texture, then this turns it into a colorized texture.
To reset the color of a material with a colorized texture, set the color to nil. If the texture is not colorized it’ll be reset to some undefined default color.
#colorize_type ⇒ Integer (rw)
This value is only relevant when the #materialType is set to MATERIAL_COLORIZED_TEXTURED.
The #colorize_type method retrieves the type of colorization of the material.
#colorize_type=(type) (rw)
This value is only relevant when the #materialType is set to MATERIAL_COLORIZED_TEXTURED.
The #colorize_type= method set the type of colorization of the material.
#metallic_factor ⇒ Float (rw)
#metallic_factor=(factor) (rw)
#metallic_texture ⇒ Sketchup::Texture (rw)
#metallic_texture=(image_path) (rw)
#metallic_texture=(image_rep)
#metallic_texture=(texture)
#metalness_enabled=(enabled) (rw)
#metalness_enabled? ⇒ Boolean (rw)
#name ⇒ String (rw)
The #name method retrieves the name of the material. This is the unique internal name of the object which should be used for retrieving the material from the model’s material list.
Use #display_name to display the name in the ::UI.
#name=(str) ⇒ String (rw)
Since SketchUp 2018 this method will raise an ArgumentError if the name is not unique.
The #name= method sets the name of the material.
#normal_enabled=(enabled) (rw)
#normal_enabled? ⇒ Boolean (rw)
#normal_scale ⇒ Float (rw)
#normal_scale=(scale) (rw)
#normal_style ⇒ Integer (rw)
#normal_style=(style) (rw)
#normal_texture ⇒ Sketchup::Texture (rw)
#normal_texture=(image_path) (rw)
#normal_texture=(image_rep)
#normal_texture=(texture)
#roughness_enabled=(enabled) (rw)
#roughness_enabled? ⇒ Boolean (rw)
#roughness_factor ⇒ Float (rw)
#roughness_factor=(factor) (rw)
#roughness_texture ⇒ Sketchup::Texture (rw)
#roughness_texture=(image_path) (rw)
#roughness_texture=(image_rep)
#roughness_texture=(texture)
#texture ⇒ Sketchup::Texture? (rw)
The #texture method retrieves the texture of the material.
#texture=(filename) (rw)
#texture=(properties)
#texture=(properties)
#texture=(image_rep)
The #texture= method sets the texture for the material.
Setting the texture to nil will turn remove it and the material will use #color.
#use_alpha? ⇒ Boolean (readonly)
Instance Method Details
#<=>(material) ⇒ Integer
The #<=> method is used to compare two materials based on ##display_name.
#==(material) ⇒ Boolean
The #== method is used to test if two materials are the same.
#colorize_deltas ⇒ Array(Float, Float, Float)
The #colorize_deltas method retrieves the HLS delta for colorized materials.
#display_name ⇒ String
The #display_name method retrieves the name that is displayed within SketchUp for the material.
This should be used when presenting the name in the ::UI, but the returned name cannot be used as a key in Model#materials.
#materialType ⇒ Integer
The #materialType method retrieves the type of the material.
-
0= solid (MATERIAL_SOLID) -
1= textured (MATERIAL_TEXTURED) -
2= colorized textured (MATERIAL_COLORIZED_TEXTURED)
The constants were added in SketchUp 2015.
#owner_type ⇒ Integer
The #owner_type method is used to determine what owns the material.
#save_as(filename) ⇒ Boolean
You must remember to append “.skm” to the filename as this will not be done automatically.
The #save_as method is used to write a material to a SKM file.
#workflow ⇒ Integer
When the workflow returns WORKFLOW_PBR_METALLIC_ROUGHNESS the properties listed under PBR Metallic Roughness Workflow are relevant.
#write_thumbnail(path, max_size) ⇒ Boolean?
The #write_thumbnail method writes a bitmap thumbnail to the given file name.