sketchup-api-stubs 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/SketchUp/Geom/BoundingBox.rb +335 -0
- data/SketchUp/Geom/LatLong.rb +123 -0
- data/SketchUp/Geom/Point3d.rb +643 -0
- data/SketchUp/Geom/PolygonMesh.rb +478 -0
- data/SketchUp/Geom/Transformation.rb +476 -0
- data/SketchUp/Geom/UTM.rb +135 -0
- data/SketchUp/Geom/Vector3d.rb +684 -0
- data/SketchUp/Sketchup/Animation.rb +137 -0
- data/SketchUp/Sketchup/AppObserver.rb +157 -0
- data/SketchUp/Sketchup/ArcCurve.rb +209 -0
- data/SketchUp/Sketchup/AttributeDictionaries.rb +146 -0
- data/SketchUp/Sketchup/AttributeDictionary.rb +280 -0
- data/SketchUp/Sketchup/Axes.rb +149 -0
- data/SketchUp/Sketchup/Behavior.rb +338 -0
- data/SketchUp/Sketchup/Camera.rb +594 -0
- data/SketchUp/Sketchup/ClassificationSchema.rb +63 -0
- data/SketchUp/Sketchup/Classifications.rb +118 -0
- data/SketchUp/Sketchup/Color.rb +291 -0
- data/SketchUp/Sketchup/ComponentDefinition.rb +562 -0
- data/SketchUp/Sketchup/ComponentInstance.rb +597 -0
- data/SketchUp/Sketchup/Console.rb +78 -0
- data/SketchUp/Sketchup/ConstructionLine.rb +257 -0
- data/SketchUp/Sketchup/ConstructionPoint.rb +32 -0
- data/SketchUp/Sketchup/Curve.rb +196 -0
- data/SketchUp/Sketchup/DefinitionList.rb +312 -0
- data/SketchUp/Sketchup/DefinitionObserver.rb +73 -0
- data/SketchUp/Sketchup/DefinitionsObserver.rb +102 -0
- data/SketchUp/Sketchup/Dimension.rb +167 -0
- data/SketchUp/Sketchup/DimensionLinear.rb +232 -0
- data/SketchUp/Sketchup/DimensionObserver.rb +38 -0
- data/SketchUp/Sketchup/DimensionRadial.rb +87 -0
- data/SketchUp/Sketchup/Drawingelement.rb +400 -0
- data/SketchUp/Sketchup/Edge.rb +517 -0
- data/SketchUp/Sketchup/EdgeUse.rb +213 -0
- data/SketchUp/Sketchup/Entities.rb +1011 -0
- data/SketchUp/Sketchup/EntitiesObserver.rb +125 -0
- data/SketchUp/Sketchup/Entity.rb +522 -0
- data/SketchUp/Sketchup/EntityObserver.rb +59 -0
- data/SketchUp/Sketchup/ExtensionsManager.rb +129 -0
- data/SketchUp/Sketchup/Face.rb +737 -0
- data/SketchUp/Sketchup/FrameChangeObserver.rb +104 -0
- data/SketchUp/Sketchup/Group.rb +705 -0
- data/SketchUp/Sketchup/Http.rb +27 -0
- data/SketchUp/Sketchup/Http/Request.rb +285 -0
- data/SketchUp/Sketchup/Http/Response.rb +62 -0
- data/SketchUp/Sketchup/Image.rb +393 -0
- data/SketchUp/Sketchup/Importer.rb +192 -0
- data/SketchUp/Sketchup/InputPoint.rb +393 -0
- data/SketchUp/Sketchup/InstanceObserver.rb +82 -0
- data/SketchUp/Sketchup/InstancePath.rb +297 -0
- data/SketchUp/Sketchup/Layer.rb +240 -0
- data/SketchUp/Sketchup/Layers.rb +235 -0
- data/SketchUp/Sketchup/LayersObserver.rb +136 -0
- data/SketchUp/Sketchup/Licensing.rb +47 -0
- data/SketchUp/Sketchup/Licensing/ExtensionLicense.rb +88 -0
- data/SketchUp/Sketchup/Loop.rb +141 -0
- data/SketchUp/Sketchup/Material.rb +384 -0
- data/SketchUp/Sketchup/Materials.rb +283 -0
- data/SketchUp/Sketchup/MaterialsObserver.rb +141 -0
- data/SketchUp/Sketchup/Menu.rb +97 -0
- data/SketchUp/Sketchup/Model.rb +1459 -0
- data/SketchUp/Sketchup/ModelObserver.rb +356 -0
- data/SketchUp/Sketchup/OptionsManager.rb +135 -0
- data/SketchUp/Sketchup/OptionsProvider.rb +277 -0
- data/SketchUp/Sketchup/OptionsProviderObserver.rb +58 -0
- data/SketchUp/Sketchup/Page.rb +636 -0
- data/SketchUp/Sketchup/Pages.rb +349 -0
- data/SketchUp/Sketchup/PagesObserver.rb +76 -0
- data/SketchUp/Sketchup/PickHelper.rb +457 -0
- data/SketchUp/Sketchup/RegionalSettings.rb +43 -0
- data/SketchUp/Sketchup/RenderingOptions.rb +337 -0
- data/SketchUp/Sketchup/RenderingOptionsObserver.rb +44 -0
- data/SketchUp/Sketchup/SectionPlane.rb +88 -0
- data/SketchUp/Sketchup/Selection.rb +470 -0
- data/SketchUp/Sketchup/SelectionObserver.rb +115 -0
- data/SketchUp/Sketchup/Set.rb +253 -0
- data/SketchUp/Sketchup/ShadowInfo.rb +257 -0
- data/SketchUp/Sketchup/ShadowInfoObserver.rb +57 -0
- data/SketchUp/Sketchup/Style.rb +77 -0
- data/SketchUp/Sketchup/Styles.rb +204 -0
- data/SketchUp/Sketchup/Text.rb +241 -0
- data/SketchUp/Sketchup/Texture.rb +211 -0
- data/SketchUp/Sketchup/TextureWriter.rb +237 -0
- data/SketchUp/Sketchup/Tool.rb +808 -0
- data/SketchUp/Sketchup/Tools.rb +120 -0
- data/SketchUp/Sketchup/ToolsObserver.rb +154 -0
- data/SketchUp/Sketchup/UVHelper.rb +61 -0
- data/SketchUp/Sketchup/Vertex.rb +143 -0
- data/SketchUp/Sketchup/View.rb +965 -0
- data/SketchUp/Sketchup/ViewObserver.rb +40 -0
- data/SketchUp/UI/Command.rb +307 -0
- data/SketchUp/UI/HtmlDialog.rb +346 -0
- data/SketchUp/UI/Notification.rb +229 -0
- data/SketchUp/UI/Toolbar.rb +243 -0
- data/SketchUp/UI/WebDialog.rb +623 -0
- data/SketchUp/_top_level.rb +193 -0
- data/SketchUp/array.rb +593 -0
- data/SketchUp/geom.rb +231 -0
- data/SketchUp/languagehandler.rb +92 -0
- data/SketchUp/length.rb +210 -0
- data/SketchUp/numeric.rb +249 -0
- data/SketchUp/sketchup.rb +1290 -0
- data/SketchUp/sketchupextension.rb +355 -0
- data/SketchUp/string.rb +24 -0
- data/SketchUp/ui.rb +637 -0
- metadata +176 -0
@@ -0,0 +1,283 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# A collection of Materials objects. Each model contains a Materials collection
|
5
|
+
# that can be accessed via Model.materials.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# # Get a handle to all the materials in the current model.
|
9
|
+
# model = Sketchup.active_model
|
10
|
+
# materials = model.materials
|
11
|
+
#
|
12
|
+
# @version SketchUp 6.0
|
13
|
+
class Sketchup::Materials < Sketchup::Entity
|
14
|
+
|
15
|
+
# Includes
|
16
|
+
|
17
|
+
include Enumerable
|
18
|
+
|
19
|
+
# Instance Methods
|
20
|
+
|
21
|
+
# The {#[]} method is used to retrieve a material by index or name.
|
22
|
+
#
|
23
|
+
# The {#at} method is an alias of {#[]}
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# model = Sketchup.active_model
|
27
|
+
# materials = model.materials
|
28
|
+
# material = materials[0]
|
29
|
+
#
|
30
|
+
# @overload [](index)
|
31
|
+
#
|
32
|
+
# @param index A number representing the material's index in an array
|
33
|
+
# of Material objects.
|
34
|
+
# @return material - a Material object on success, Nil on failure
|
35
|
+
#
|
36
|
+
# @overload [](name)
|
37
|
+
#
|
38
|
+
# @param name The name of the material.
|
39
|
+
# @return material - a Material object on success, Nil on failure
|
40
|
+
#
|
41
|
+
# @version SketchUp 6.0
|
42
|
+
def [](arg)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Add a new Material. When called with no arguments, this will generate a
|
46
|
+
# new unique name for the new Material. If a name is given, it will check
|
47
|
+
# to see if there is already a material with that name. If there is already
|
48
|
+
# a material with the given name, then a new unique name is generated using
|
49
|
+
# the given name as a base.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
# model = Sketchup.active_model
|
53
|
+
# materials = model.materials
|
54
|
+
# material = materials.add('Joe')
|
55
|
+
#
|
56
|
+
# @param name
|
57
|
+
# The name of the new material.
|
58
|
+
#
|
59
|
+
# @return material - a Material object
|
60
|
+
#
|
61
|
+
# @version SketchUp 6.0
|
62
|
+
def add(name)
|
63
|
+
end
|
64
|
+
|
65
|
+
# The add_observer method is used to add an observer to the materials
|
66
|
+
# collection.
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# materials = Sketchup.active_model.materials
|
70
|
+
# status = materials.add_observer(observer)
|
71
|
+
#
|
72
|
+
# @param observer
|
73
|
+
# An observer.
|
74
|
+
#
|
75
|
+
# @return success - true if successful, false if unsuccessful.
|
76
|
+
#
|
77
|
+
# @version SketchUp 6.0
|
78
|
+
def add_observer(observer)
|
79
|
+
end
|
80
|
+
|
81
|
+
# The {#[]} method is used to retrieve a material by index or name.
|
82
|
+
#
|
83
|
+
# The {#at} method is an alias of {#[]}
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# model = Sketchup.active_model
|
87
|
+
# materials = model.materials
|
88
|
+
# material = materials[0]
|
89
|
+
#
|
90
|
+
# @overload [](index)
|
91
|
+
#
|
92
|
+
# @param index A number representing the material's index in an array
|
93
|
+
# of Material objects.
|
94
|
+
# @return material - a Material object on success, Nil on failure
|
95
|
+
#
|
96
|
+
# @overload [](name)
|
97
|
+
#
|
98
|
+
# @param name The name of the material.
|
99
|
+
# @return material - a Material object on success, Nil on failure
|
100
|
+
#
|
101
|
+
# @version SketchUp 6.0
|
102
|
+
def at(arg)
|
103
|
+
end
|
104
|
+
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
# materials = Sketchup.active_model.materials
|
108
|
+
# count = materials.count
|
109
|
+
#
|
110
|
+
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
111
|
+
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
112
|
+
# for {#length}.
|
113
|
+
#
|
114
|
+
# @return integer - number of materials in the collection.
|
115
|
+
#
|
116
|
+
# @see #length
|
117
|
+
#
|
118
|
+
# @version SketchUp 6.0
|
119
|
+
def count
|
120
|
+
end
|
121
|
+
|
122
|
+
# The current method is used to get the current material, i.e. the material
|
123
|
+
# that the user has selected in the Materials dialog.
|
124
|
+
#
|
125
|
+
# @example
|
126
|
+
# current = Sketchup.active_model.materials.current
|
127
|
+
#
|
128
|
+
# @return material - a Material object.
|
129
|
+
#
|
130
|
+
# @version SketchUp 6.0
|
131
|
+
def current
|
132
|
+
end
|
133
|
+
|
134
|
+
# The current= method is used to set the current material.
|
135
|
+
#
|
136
|
+
# @example
|
137
|
+
# # Make the first material in the model "current"
|
138
|
+
# materials = Sketchup.active_model.materials
|
139
|
+
# materials.current = materials[0]
|
140
|
+
#
|
141
|
+
# @param material
|
142
|
+
# A Material object.
|
143
|
+
#
|
144
|
+
# @return true if successful, false if unsuccessful.
|
145
|
+
#
|
146
|
+
# @version SketchUp 6.0
|
147
|
+
def current=(material)
|
148
|
+
end
|
149
|
+
|
150
|
+
# The each method is used to iterate through all of the materials.
|
151
|
+
#
|
152
|
+
# @example
|
153
|
+
# model = Sketchup.active_model
|
154
|
+
# model.materials.each { |material|
|
155
|
+
# puts material.display_name
|
156
|
+
# }
|
157
|
+
#
|
158
|
+
# @return material - a Material object
|
159
|
+
#
|
160
|
+
# @version SketchUp 6.0
|
161
|
+
#
|
162
|
+
# @yield [material] A variable that will hold each Material object as they
|
163
|
+
# are found.
|
164
|
+
def each
|
165
|
+
end
|
166
|
+
|
167
|
+
# The number of materials in the collection.
|
168
|
+
#
|
169
|
+
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
170
|
+
#
|
171
|
+
# @example
|
172
|
+
# materials = Sketchup.active_model.materials
|
173
|
+
# number = materials.length
|
174
|
+
#
|
175
|
+
# @return integer - number of materials in the collection.
|
176
|
+
#
|
177
|
+
# @version SketchUp 6.0
|
178
|
+
def length
|
179
|
+
end
|
180
|
+
|
181
|
+
# The {#load} method is used to load a material from file into the model.
|
182
|
+
#
|
183
|
+
# If a matching material exist in the model that will be returned instead.
|
184
|
+
#
|
185
|
+
# @example
|
186
|
+
# # Load a material from the shipped SketchUp library. (SketchUp 2016)
|
187
|
+
# filename = 'Materials/Brick, Cladding and Siding/Cinder Block.skm'
|
188
|
+
# path = Sketchup.find_support_file(filename)
|
189
|
+
# materials = Sketchup.active_model.materials
|
190
|
+
# material = materials.load(path)
|
191
|
+
#
|
192
|
+
# @param [String] filename
|
193
|
+
# the path to the SKM file to load.
|
194
|
+
#
|
195
|
+
# @raise [RuntimeError] if the material failed to load.
|
196
|
+
#
|
197
|
+
# @return [Sketchup::Material] the new loaded material, or existing material.
|
198
|
+
#
|
199
|
+
# @version SketchUp 2017
|
200
|
+
def load(filename)
|
201
|
+
end
|
202
|
+
|
203
|
+
# The purge_unused method is used to remove unused materials.
|
204
|
+
#
|
205
|
+
# @example
|
206
|
+
# materials = Sketchup.active_model.materials
|
207
|
+
# materials.purge_unused
|
208
|
+
#
|
209
|
+
# @return materials - The Materials object.
|
210
|
+
#
|
211
|
+
# @version SketchUp 6.0
|
212
|
+
def purge_unused
|
213
|
+
end
|
214
|
+
|
215
|
+
# Remove a given material.
|
216
|
+
#
|
217
|
+
# NOTE: On SketchUp versions prior to 2014 there is a bug in this method that
|
218
|
+
# could potentially lead to file corruption. If you call Materials.remove on a
|
219
|
+
# material that is painted onto any entity in the active model (e.g. faces,
|
220
|
+
# edges, groups, ...), then calling this method will not successfully unpaint
|
221
|
+
# the entity and remove the material from the model.
|
222
|
+
# You must first unpaint all of the entities that respond to .material
|
223
|
+
# and .back_material before calling Materials.remove.
|
224
|
+
#
|
225
|
+
# @example
|
226
|
+
# if entity.respond_to?(:material) do
|
227
|
+
# if entity.material.equal?(material_to_remove) do
|
228
|
+
# entity.material = nil
|
229
|
+
# end
|
230
|
+
# end
|
231
|
+
# # for entities that have a back material
|
232
|
+
# if entity.respond_to?(:back_material) do
|
233
|
+
# if entity.back_material.equal?(material_to_remove) do
|
234
|
+
# entity.back_material = nil
|
235
|
+
# end
|
236
|
+
# end
|
237
|
+
#
|
238
|
+
# @example
|
239
|
+
# model = Sketchup.active_model
|
240
|
+
# materials = model.materials
|
241
|
+
# material = materials.add('Joe')
|
242
|
+
# materials.remove(material)
|
243
|
+
#
|
244
|
+
# @param material
|
245
|
+
# The material to remove.
|
246
|
+
#
|
247
|
+
# @return status - true if successful, false if unsuccessful.
|
248
|
+
#
|
249
|
+
# @version SketchUp 8.0 M1
|
250
|
+
def remove(material)
|
251
|
+
end
|
252
|
+
|
253
|
+
# The remove_observer method is used to remove an observer from the materials
|
254
|
+
# collection.
|
255
|
+
#
|
256
|
+
# @example
|
257
|
+
# materials = Sketchup.active_model.materials
|
258
|
+
# status = materials.remove_observer(observer)
|
259
|
+
#
|
260
|
+
# @param observer
|
261
|
+
# An observer.
|
262
|
+
#
|
263
|
+
# @return success - true if successful, false if unsuccessful.
|
264
|
+
#
|
265
|
+
# @version SketchUp 6.0
|
266
|
+
def remove_observer(observer)
|
267
|
+
end
|
268
|
+
|
269
|
+
# The number of materials in the collection.
|
270
|
+
#
|
271
|
+
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
272
|
+
#
|
273
|
+
# @example
|
274
|
+
# materials = Sketchup.active_model.materials
|
275
|
+
# number = materials.length
|
276
|
+
#
|
277
|
+
# @return integer - number of materials in the collection.
|
278
|
+
#
|
279
|
+
# @version SketchUp 6.0
|
280
|
+
def size
|
281
|
+
end
|
282
|
+
|
283
|
+
end
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This observer interface is implemented to react to materials events. To
|
5
|
+
# implement this observer, create a Ruby class of this type, override the
|
6
|
+
# desired methods, and add an instance of the observer to the objects of
|
7
|
+
# interests.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# class MyMaterialsObserver < Sketchup::MaterialsObserver
|
11
|
+
# def onMaterialAdd(materials, material)
|
12
|
+
# puts "onMaterialAdd: #{material}"
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# Sketchup.active_model.materials.add_observer(MyMaterialsObserver.new)
|
17
|
+
#
|
18
|
+
# @note The callback +onMaterialRemoveAll+ has been deprecated, we recommend using
|
19
|
+
# {#onMaterialRemove} instead.
|
20
|
+
#
|
21
|
+
# @version SketchUp 6.0
|
22
|
+
class Sketchup::MaterialsObserver
|
23
|
+
|
24
|
+
# Instance Methods
|
25
|
+
|
26
|
+
# The {#onMaterialAdd} method is invoked whenever a new material is added.
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# def onMaterialAdd(materials, material)
|
30
|
+
# puts "onMaterialAdd: #{material}"
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# @param [Sketchup::Materials] materials
|
34
|
+
#
|
35
|
+
# @param [Sketchup::Material] material
|
36
|
+
#
|
37
|
+
# @return [nil]
|
38
|
+
#
|
39
|
+
# @version SketchUp 6.0
|
40
|
+
def onMaterialAdd(materials, material)
|
41
|
+
end
|
42
|
+
|
43
|
+
# The {#onMaterialChange} method is invoked whenever a material's texture image
|
44
|
+
# is altered.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# def onMaterialChange(materials, material)
|
48
|
+
# puts "onMaterialChange: #{material}"
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @param [Sketchup::Materials] materials
|
52
|
+
#
|
53
|
+
# @param [Sketchup::Material] material
|
54
|
+
#
|
55
|
+
# @return [nil]
|
56
|
+
#
|
57
|
+
# @version SketchUp 6.0
|
58
|
+
def onMaterialChange(materials, material)
|
59
|
+
end
|
60
|
+
|
61
|
+
# The {#onMaterialRefChange} method is invoked whenever the number of entities
|
62
|
+
# that a material is painted on changes. This could be due to the user
|
63
|
+
# manually painting something, but it could also be when faces are split,
|
64
|
+
# pasted, push-pulled, deleted, etc.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# def onMaterialRefChange(materials, material)
|
68
|
+
# puts "onMaterialRefChange: #{material}"
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# @param [Sketchup::Materials] materials
|
72
|
+
#
|
73
|
+
# @param [Sketchup::Material] material
|
74
|
+
#
|
75
|
+
# @return [nil]
|
76
|
+
#
|
77
|
+
# @version SketchUp 6.0
|
78
|
+
def onMaterialRefChange(materials, material)
|
79
|
+
end
|
80
|
+
|
81
|
+
# The {#onMaterialRemove} method is invoked whenever a material is deleted.
|
82
|
+
#
|
83
|
+
# @example
|
84
|
+
# def onMaterialRemove(materials, material)
|
85
|
+
# puts "onMaterialRemove: #{material}"
|
86
|
+
# end
|
87
|
+
#
|
88
|
+
# @param [Sketchup::Materials] materials
|
89
|
+
#
|
90
|
+
# @param [Sketchup::Material] material
|
91
|
+
#
|
92
|
+
# @return [nil]
|
93
|
+
#
|
94
|
+
# @version SketchUp 6.0
|
95
|
+
def onMaterialRemove(materials, material)
|
96
|
+
end
|
97
|
+
|
98
|
+
# The {#onMaterialSetCurrent} method is invoked whenever a different material
|
99
|
+
# is selected in the Materials dialog.
|
100
|
+
#
|
101
|
+
# The materials parameter might be Nil when the material is picked from the
|
102
|
+
# materials libraries and not yet added to the model.
|
103
|
+
#
|
104
|
+
# @example
|
105
|
+
# def onMaterialSetCurrent(materials, material)
|
106
|
+
# puts "onMaterialSetCurrent: #{material}"
|
107
|
+
# end
|
108
|
+
#
|
109
|
+
# @param [Sketchup::Materials] materials
|
110
|
+
#
|
111
|
+
# @param [Sketchup::Material] material
|
112
|
+
#
|
113
|
+
# @return [nil]
|
114
|
+
#
|
115
|
+
# @version SketchUp 6.0
|
116
|
+
def onMaterialSetCurrent(materials, material)
|
117
|
+
end
|
118
|
+
|
119
|
+
# The {#onMaterialUndoRedo} method is invoked whenever a material is altered
|
120
|
+
# and then those changes are undone or redone.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# def onMaterialUndoRedo(materials, material)
|
124
|
+
# puts "onMaterialUndoRedo: #{material}"
|
125
|
+
# end
|
126
|
+
#
|
127
|
+
# @note Due to a bug, this callback does not fire in SU6 or SU7. You can use
|
128
|
+
# the {Sketchup::ModelObserver#onTransactionStart} to capture all undo
|
129
|
+
# events.
|
130
|
+
#
|
131
|
+
# @param [Sketchup::Material] material
|
132
|
+
#
|
133
|
+
# @param [Sketchup::Materials] materials
|
134
|
+
#
|
135
|
+
# @return [nil]
|
136
|
+
#
|
137
|
+
# @version SketchUp 6.0
|
138
|
+
def onMaterialUndoRedo(materials, material)
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# An interface to a menu.
|
5
|
+
#
|
6
|
+
# @version SketchUp 6.0
|
7
|
+
class Sketchup::Menu
|
8
|
+
|
9
|
+
# Instance Methods
|
10
|
+
|
11
|
+
# The add_item menu item is used to add a menu item to the specified menu.
|
12
|
+
#
|
13
|
+
# This method takes a block that defines the action to perform when the menu
|
14
|
+
# item is selected.
|
15
|
+
#
|
16
|
+
# The item id that is returned can be used when adding an optional
|
17
|
+
# validation procedure for the menu item.
|
18
|
+
#
|
19
|
+
# @example
|
20
|
+
# plugins_menu = UI.menu("Plugins")
|
21
|
+
# item = plugins_menu.add_item("Test") { test }
|
22
|
+
# if (item)
|
23
|
+
# UI.messagebox item
|
24
|
+
# else
|
25
|
+
# UI.messagebox "Failure"
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# @param menu
|
29
|
+
# A string name of the menu to add.
|
30
|
+
#
|
31
|
+
# @return item_id - a unique integer id for the added menu item.
|
32
|
+
#
|
33
|
+
# @version SketchUp 6.0
|
34
|
+
#
|
35
|
+
# @yield A method that will be invoked when the menu item is
|
36
|
+
# selected.
|
37
|
+
def add_item(menu, &block)
|
38
|
+
end
|
39
|
+
|
40
|
+
# The add_separator method is used to add a menu separator to a menu.
|
41
|
+
#
|
42
|
+
# @example
|
43
|
+
# plugins_menu = UI.menu("Plugins")
|
44
|
+
# plugins_menu.add_separator
|
45
|
+
#
|
46
|
+
# @return nil
|
47
|
+
#
|
48
|
+
# @version SketchUp 6.0
|
49
|
+
def add_separator
|
50
|
+
end
|
51
|
+
|
52
|
+
# The add_submenu method is used to add a sub-menu to a menu.
|
53
|
+
#
|
54
|
+
# @example
|
55
|
+
# plugins_menu = UI.menu("Plugins")
|
56
|
+
# submenu = plugins_menu.add_submenu("Test")
|
57
|
+
# submenu.add_item("Hello World") {
|
58
|
+
# UI.messagebox("Hi there!")
|
59
|
+
# }
|
60
|
+
#
|
61
|
+
# @param [String] title
|
62
|
+
# The title of the sub menu.
|
63
|
+
#
|
64
|
+
# @return submenu - a Menu object
|
65
|
+
#
|
66
|
+
# @version SketchUp 6.0
|
67
|
+
def add_submenu(title)
|
68
|
+
end
|
69
|
+
|
70
|
+
# The set_validation_proc method is used to identify the menu validation
|
71
|
+
# procedure. Your procedure should return either MF_ENABLED, MF_DISABLED,
|
72
|
+
# MF_CHECKED, MF_UNCHECKED, or MF_GRAYED.
|
73
|
+
#
|
74
|
+
# @example
|
75
|
+
# plugins_menu = UI.menu("Plugins")
|
76
|
+
# item = plugins_menu.add_item("Test") { UI.messagebox "My Test Item"}
|
77
|
+
# status = plugins_menu.set_validation_proc(item) {
|
78
|
+
# if Sketchup.is_pro?
|
79
|
+
# MF_ENABLED
|
80
|
+
# else
|
81
|
+
# MF_GRAYED
|
82
|
+
# end
|
83
|
+
# }
|
84
|
+
#
|
85
|
+
# @param menu
|
86
|
+
# A string name of the menu to add.
|
87
|
+
#
|
88
|
+
# @return item_id - a unique numerical item id for the menu
|
89
|
+
#
|
90
|
+
# @version SketchUp 6.0
|
91
|
+
#
|
92
|
+
# @yield A method that will be invoked when the menu item is
|
93
|
+
# selected.
|
94
|
+
def set_validation_proc(menu, &block)
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|