Class: Sketchup::Materials
- Includes:
- Enumerable
- Defined in:
- SketchUp/Sketchup/Materials.rb
Overview
A collection of Materials objects. Each model contains a Materials collection that can be accessed via Model.materials.
Instance Method Summary collapse
-
#[](arg) ⇒ Object
The #[] method is used to retrieve a material by index or name.
-
#add(name) ⇒ Sketchup::Material
Add a new Material.
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the materials collection.
-
#at(arg) ⇒ Object
The #[] method is used to retrieve a material by index or name.
- #count ⇒ Integer
-
#current ⇒ Sketchup::Material
The current method is used to get the current material, i.e.
-
#current=(material) ⇒ Sketchup::Material
The current= method is used to set the current material.
-
#each {|Sketchup::Material| ... } ⇒ nil
The each method is used to iterate through all of the materials.
-
#length ⇒ Integer
The number of materials in the collection.
-
#load(filename) ⇒ Sketchup::Material
The #load method is used to load a material from file into the model.
-
#purge_unused ⇒ Sketchup::Materials
The purge_unused method is used to remove unused materials.
-
#remove(material) ⇒ Boolean
Remove a given material.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the materials collection.
-
#size ⇒ Integer
The number of materials in the collection.
-
#unique_name(name) ⇒ String
The #unique_name method is used to retrieve a unique name from the materials collection that is based on the provided one.
Methods inherited from Entity
#attribute_dictionaries, #attribute_dictionary, #delete_attribute, #deleted?, #entityID, #get_attribute, #inspect, #model, #parent, #persistent_id, #set_attribute, #to_s, #typename, #valid?
Instance Method Details
#[](index) ⇒ Sketchup::Material? #[](name) ⇒ Sketchup::Material?
42 43 |
# File 'SketchUp/Sketchup/Materials.rb', line 42 def [](arg) end |
#add(name) ⇒ Sketchup::Material
Add a new Material. When called with no arguments, this will generate a new unique name for the new Material. If a name is given, it will check to see if there is already a material with that name. If there is already a material with the given name, then a new unique name is generated using the given name as a base.
62 63 |
# File 'SketchUp/Sketchup/Materials.rb', line 62 def add(name) end |
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the materials collection.
78 79 |
# File 'SketchUp/Sketchup/Materials.rb', line 78 def add_observer(observer) end |
#[](index) ⇒ Sketchup::Material? #[](name) ⇒ Sketchup::Material?
102 103 |
# File 'SketchUp/Sketchup/Materials.rb', line 102 def at(arg) end |
#count ⇒ Integer
119 120 |
# File 'SketchUp/Sketchup/Materials.rb', line 119 def count end |
#current ⇒ Sketchup::Material
The current method is used to get the current material, i.e. the material that the user has selected in the Materials dialog.
131 132 |
# File 'SketchUp/Sketchup/Materials.rb', line 131 def current end |
#current=(material) ⇒ Sketchup::Material
The current= method is used to set the current material.
147 148 |
# File 'SketchUp/Sketchup/Materials.rb', line 147 def current=(material) end |
#each {|Sketchup::Material| ... } ⇒ nil
The each method is used to iterate through all of the materials.
164 165 |
# File 'SketchUp/Sketchup/Materials.rb', line 164 def each end |
#length ⇒ Integer
182 183 |
# File 'SketchUp/Sketchup/Materials.rb', line 182 def length end |
#load(filename) ⇒ Sketchup::Material
The #load method is used to load a material from file into the model.
If a matching material exist in the model that will be returned instead.
204 205 |
# File 'SketchUp/Sketchup/Materials.rb', line 204 def load(filename) end |
#purge_unused ⇒ Sketchup::Materials
The purge_unused method is used to remove unused materials.
216 217 |
# File 'SketchUp/Sketchup/Materials.rb', line 216 def purge_unused end |
#remove(material) ⇒ Boolean
Remove a given material.
NOTE: On SketchUp versions prior to 2014 there is a bug in this method that could potentially lead to file corruption. If you call Materials.remove on a material that is painted onto any entity in the active model (e.g. faces, edges, groups, …), then calling this method will not successfully unpaint the entity and remove the material from the model. You must first unpaint all of the entities that respond to .material and .back_material before calling Materials.remove.
254 255 |
# File 'SketchUp/Sketchup/Materials.rb', line 254 def remove(material) end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the materials collection.
270 271 |
# File 'SketchUp/Sketchup/Materials.rb', line 270 def remove_observer(observer) end |
#size ⇒ Integer
290 291 |
# File 'SketchUp/Sketchup/Materials.rb', line 290 def size end |
#unique_name(name) ⇒ String
The #unique_name method is used to retrieve a unique name from the materials collection that is based on the provided one. If provided name is unique it will be returned, otherwise any trailing indices will be replaced by a new index.
308 309 |
# File 'SketchUp/Sketchup/Materials.rb', line 308 def unique_name(name) end |