Class: Sketchup::MaterialsObserver Abstract
- Inherits:
-
Object
- Object
- Sketchup::MaterialsObserver
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb
Overview
To implement this observer, create a Ruby class of this type, override the desired methods, and add an instance of the observer to the objects of interests.
The callback onMaterialRemoveAll
has been deprecated, we recommend using #onMaterialRemove instead.
This observer interface is implemented to react to materials events.
Instance Method Summary collapse
-
#onMaterialAdd(materials, material) ⇒ nil
The #onMaterialAdd method is invoked whenever a new material is added.
-
#onMaterialChange(materials, material) ⇒ nil
The #onMaterialChange method is invoked whenever a material’s texture image is altered.
-
#onMaterialRefChange(materials, material) ⇒ nil
The #onMaterialRefChange method is invoked whenever the number of entities that a material is painted on changes.
-
#onMaterialRemove(materials, material) ⇒ nil
The #onMaterialRemove method is invoked whenever a material is deleted.
-
#onMaterialSetCurrent(materials, material) ⇒ nil
The #onMaterialSetCurrent method is invoked whenever a different material is selected in the Materials dialog.
-
#onMaterialUndoRedo(materials, material) ⇒ nil
The #onMaterialUndoRedo method is invoked whenever a material is altered and then those changes are undone or redone.
Instance Method Details
#onMaterialAdd(materials, material) ⇒ nil
The #onMaterialAdd method is invoked whenever a new material is added.
41 42 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb', line 41 def onMaterialAdd(materials, material) end |
#onMaterialChange(materials, material) ⇒ nil
The #onMaterialChange method is invoked whenever a material’s texture image is altered.
59 60 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb', line 59 def onMaterialChange(materials, material) end |
#onMaterialRefChange(materials, material) ⇒ nil
The #onMaterialRefChange method is invoked whenever the number of entities that a material is painted on changes. This could be due to the user manually painting something, but it could also be when faces are split, pasted, push-pulled, deleted, etc.
79 80 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb', line 79 def onMaterialRefChange(materials, material) end |
#onMaterialRemove(materials, material) ⇒ nil
The #onMaterialRemove method is invoked whenever a material is deleted.
96 97 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb', line 96 def onMaterialRemove(materials, material) end |
#onMaterialSetCurrent(materials, material) ⇒ nil
The #onMaterialSetCurrent method is invoked whenever a different material is selected in the Materials dialog.
The materials parameter might be Nil when the material is picked from the materials libraries and not yet added to the model.
117 118 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb', line 117 def onMaterialSetCurrent(materials, material) end |
#onMaterialUndoRedo(materials, material) ⇒ nil
Due to a bug, this callback does not fire in SU6 or SU7. You can use the Sketchup::ModelObserver#onTransactionStart to capture all undo events.
The #onMaterialUndoRedo method is invoked whenever a material is altered and then those changes are undone or redone.
139 140 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb', line 139 def onMaterialUndoRedo(materials, material) end |