sketchup-api-stubs 0.7.9 → 0.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +157 -151
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
  151. data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
  159. data/lib/sketchup-api-stubs.rb +1 -1
  160. metadata +10 -24
@@ -1,414 +1,1115 @@
1
- # Copyright:: Copyright 2023 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The Material class represents a texture or color that can be applied to
5
- # Drawingelements. It is most often applied to Faces.
6
- #
7
- # You can pass any object that can be used as a material to a method that
8
- # requires a material. Objects include actual materials, color, and classes
9
- # that can be converted to a color.
10
- #
11
- # The following are valid (assuming the existence of a Material mat1.)
12
- #
13
- # @example
14
- # face.material = mat1
15
- # face.material = "red"
16
- # face.material = 0xff0000
17
- #
18
- # @version SketchUp 6.0
19
- class Sketchup::Material < Sketchup::Entity
20
-
21
- # Includes
22
-
23
- include Comparable
24
-
25
- # Constants
26
-
27
- COLORIZE_SHIFT = nil # Stub value.
28
- COLORIZE_TINT = nil # Stub value.
29
-
30
- MATERIAL_COLORIZED_TEXTURED = nil # Stub value.
31
- MATERIAL_SOLID = nil # Stub value.
32
- MATERIAL_TEXTURED = nil # Stub value.
33
-
34
- OWNER_IMAGE = nil # Stub value.
35
- OWNER_LAYER = nil # Stub value.
36
- OWNER_MANAGER = nil # Stub value.
37
-
38
- # Instance Methods
39
-
40
- # The <=> method is used to compare two materials based on name. The number
41
- # returned relates to the "string distance" between the names.
42
- #
43
- # @example
44
- # model = Sketchup.active_model
45
- # materials = model.materials
46
- # m1 = materials.add('Joe')
47
- # m2 = materials.add('Fred')
48
- # p m1 <=> m2
49
- #
50
- # @param [Sketchup::Material] material2
51
- # A Material object.
52
- #
53
- # @return [Integer] 0 if they are equal, positive number if
54
- # material1 > material2, negative if material1 < material2
55
- #
56
- # @version SketchUp 6.0
57
- def <=>(material2)
58
- end
59
-
60
- # The == method is used to test if two materials are the same.
61
- #
62
- # @example
63
- # model = Sketchup.active_model
64
- # materials = model.materials
65
- # m1 = materials.add('Joe')
66
- # m2 = materials.add('Fred')
67
- # if (m1 == m2)
68
- # UI.messagebox('The Materials are equal.')
69
- # else
70
- # UI.messagebox('The Materials are not equal.')
71
- # end
72
- #
73
- # @param [Sketchup::Material] material2
74
- # A Material object.
75
- #
76
- # @return [Boolean] true if the materials are the same, false if
77
- # they are different
78
- #
79
- # @version SketchUp 6.0
80
- def ==(material2)
81
- end
82
-
83
- # The alpha method is used to get the opacity of the material.
84
- #
85
- # The value will be between 0.0 and 1.0. A value of 0.0 means that the material is
86
- # completely transparent. A value of 1.0 means that the Material is completely
87
- # opaque.
88
- #
89
- # @example
90
- # alpha_value = Sketchup.active_model.materials[0].alpha
91
- #
92
- # @return [Float] a number between 0 and 1
93
- #
94
- # @version SketchUp 6.0
95
- def alpha
96
- end
97
-
98
- # The alpha= method is used to set the opacity of the material.
99
- #
100
- # The value must be between 0.0 and 1.0. A value of 0.0 means that the material is
101
- # completely transparent. A value of 1.0 means that the Material is completely
102
- # opaque.
103
- #
104
- # @example
105
- # model = Sketchup.active_model
106
- # materials = model.materials
107
- # material = materials.add('Joe')
108
- # material.alpha = 0.5
109
- #
110
- # @param [Float] alpha
111
- # An opacity value.
112
- #
113
- # @return [Float] the newly set opacity value
114
- #
115
- # @version SketchUp 6.0
116
- def alpha=(alpha)
117
- end
118
-
119
- # The color method is used to retrieve the color of the material.
120
- #
121
- # If it uses a Texture, this will return the average color.
122
- #
123
- # @example
124
- # model = Sketchup.active_model
125
- # materials = model.materials
126
- # material = materials.add('Joe')
127
- # material.color = 'red'
128
- # color = material.color
129
- #
130
- # @return [Sketchup::Color] a Color object
131
- #
132
- # @version SketchUp 6.0
133
- def color
134
- end
135
-
136
- # The color= method is used to set the color of the material.
137
- #
138
- # If the Material has a texture, then this turns it into a colorized
139
- # texture.
140
- #
141
- # To reset the color of a Material with a texture, set the color
142
- # to nil.
143
- #
144
- # @example
145
- # model = Sketchup.active_model
146
- # materials = model.materials
147
- # material = materials.add('Joe')
148
- # material.color = 'red'
149
- #
150
- # @param [Sketchup::Color, String, nil] color
151
- # A Color object.
152
- #
153
- # @return [Sketchup::Color, String, nil] the newly set Color object
154
- #
155
- # @version SketchUp 6.0
156
- def color=(color)
157
- end
158
-
159
- # The colorize_deltas method retrieves the HLS delta for colorized materials.
160
- #
161
- # @example
162
- # material = Sketchup.active_model.materials[0]
163
- # h, l, s = material.colorize_deltas
164
- #
165
- # @return [Array(Float, Float, Float)] An array of floats representing the HLS delta.
166
- #
167
- # @version SketchUp 2015
168
- def colorize_deltas
169
- end
170
-
171
- # The colorize_type method retrieves the type of colorization of the material.
172
- # This value is only relevant when the materialType is set to 2
173
- # (colorized textured).
174
- # Types include:
175
- #
176
- # - 0 = shift (Sketchup::Material::COLORIZE_SHIFT),
177
- # - 1 = tint (Sketchup::Material::COLORIZE_TINT),
178
- #
179
- # @example
180
- # material = Sketchup.active_model.materials[0]
181
- # type = material.colorize_type
182
- #
183
- # @return [Integer] the colorize type for the Material object.
184
- #
185
- # @version SketchUp 2015
186
- def colorize_type
187
- end
188
-
189
- # The colorize_type method set the type of colorization of the material.
190
- # This value is only relevant when the materialType is set to 2
191
- # (colorized textured).
192
- # Types include:
193
- #
194
- # - 0 = shift (Sketchup::Material::COLORIZE_SHIFT),
195
- # - 1 = tint (Sketchup::Material::COLORIZE_TINT),
196
- #
197
- # @example
198
- # material = Sketchup.active_model.materials[0]
199
- # material.colorize_type = Sketchup::Material::COLORIZE_TINT
200
- #
201
- # @param [Integer] type
202
- # the new colorize type for the Material object.
203
- #
204
- # @return [Integer] the colorize type for the Material object.
205
- #
206
- # @version SketchUp 2015
207
- def colorize_type=(type)
208
- end
209
-
210
- # The display_name method retrieves the name that is displayed within SketchUp
211
- # for the material.
212
- #
213
- # This should be used when presenting the name in the UI, but the returned name
214
- # cannot be used as a key in model.materials.
215
- #
216
- # @example
217
- # model = Sketchup.active_model
218
- # materials = model.materials
219
- # material = materials.add('[Joe]')
220
- # # Use .name for the internal name of a material
221
- # puts material.name # Outputs "[Joe]"
222
- # # Use .display_name for presenting the material name
223
- # # to the UI like SketchUp does.
224
- # puts material.display_name # Outputs "Joe"
225
- #
226
- # @return [String] the display name for the material
227
- #
228
- # @version SketchUp 6.0
229
- def display_name
230
- end
231
-
232
- # The materialType method retrieves the type of the material. Types include:
233
- #
234
- # - 0 = solid (Sketchup::Material::MATERIAL_SOLID),
235
- # - 1 = textured (Sketchup::Material::MATERIAL_TEXTURED),
236
- # - 2 = colorized textured (Sketchup::Material::MATERIAL_COLORIZED_TEXTURED).
237
- #
238
- # The constants where added in SketchUp 2015.
239
- #
240
- # @example
241
- # material = Sketchup.active_model.materials[0]
242
- # type = material.materialType
243
- #
244
- # @return [Integer] the material type for the Material object. See
245
- # summary for details.
246
- #
247
- # @version SketchUp 6.0
248
- def materialType
249
- end
250
-
251
- # The name method retrieves the name of the material. This is the
252
- # internal name of the object which should be used for retrieving
253
- # the material from the model's material list.
254
- #
255
- # Use .display_name to display the name in the UI.
256
- #
257
- # @example
258
- # model = Sketchup.active_model
259
- # materials = model.materials
260
- # material = materials.add('[Joe]')
261
- # # Use .name for the internal name of a material
262
- # puts material.name # Outputs "[Joe]"
263
- # # Use .display_name for presenting the material name
264
- # # to the UI like SketchUp does.
265
- # puts material.display_name # Outputs "Joe"
266
- #
267
- # @return [String] the name of the Material object
268
- #
269
- # @version SketchUp 6.0
270
- def name
271
- end
272
-
273
- # The {#name=} method sets the name of the material.
274
- #
275
- # @example Safely change name without raising errors
276
- # materials = Sketchup.active_model.materials
277
- # material = materials.add("Joe")
278
- # material.name = materials.unique_name('Jeff')
279
- #
280
- # @note Since SketchUp 2018 this method will raise an `ArgumentError` if the
281
- # name is not unique.
282
- #
283
- # @note SketchUp 2018 would raise an error if you named material the name it
284
- # already had.
285
- #
286
- # @param [String] str
287
- # the new material name
288
- #
289
- # @raise [ArgumentError] if the name is not unique to the model.
290
- # (Added in SU2018)
291
- #
292
- # @return [String] the newly set material name.
293
- #
294
- # @version SketchUp 8.0 M1
295
- def name=(str)
296
- end
297
-
298
- # The {#owner_type} method is used to determine if the material is owned
299
- # by a {Sketchup::Materials}.
300
- #
301
- # Returned value is one of:
302
- # * +Sketchup::Material::OWNER_MANAGER+
303
- # * +Sketchup::Material::OWNER_IMAGE+
304
- # * +Sketchup::Material::OWNER_LAYER+
305
- #
306
- # @return [Integer]
307
- #
308
- # @version SketchUp 2019.2
309
- def owner_type
310
- end
311
-
312
- # The {#save_as} method is used to write a material to a SKM file.
313
- #
314
- # You must remember to append ".skm" to the filename as this will not be done
315
- # automatically.
316
- #
317
- # @example
318
- # filename = File.join(ENV['HOME'], 'Desktop', 'su_test.skm')
319
- # materials = Sketchup.active_model.materials
320
- # material = materials.add("Hello World")
321
- # material.color = 'red'
322
- # material.save_as(filename)
323
- #
324
- # @param [String] filename
325
- # the path to the SKM file to load.
326
- #
327
- # @return [Boolean] `true` if successful
328
- #
329
- # @version SketchUp 2017
330
- def save_as(filename)
331
- end
332
-
333
- # The texture method retrieves the texture of the material.
334
- #
335
- # @example
336
- # model = Sketchup.active_model
337
- # materials = model.materials
338
- # material = materials.add('Joe')
339
- # material.texture = "C:/Materials/Carpet.jpg"
340
- # texture = material.texture
341
- #
342
- # @return [Sketchup::Texture, nil] the Texture object within the Material.
343
- # Returns nil if the Material does not have a texture.
344
- #
345
- # @version SketchUp 6.0
346
- def texture
347
- end
348
-
349
- # The texture= method sets the texture for the material.
350
- #
351
- # Setting the texture to +nil+ will turn it into a solid color
352
- #
353
- # @example
354
- # model = Sketchup.active_model
355
- # materials = model.materials
356
- # material = materials.add('Joe')
357
- # material.texture = "C:/Materials/Carpet.jpg"
358
- #
359
- # @overload texture=(filename)
360
- #
361
- # @param [String] filename
362
- # The file path to the texture the material should use.
363
- #
364
- # @overload texture=(properties)
365
- #
366
- # @param [Array(String, Length, Length)] properties
367
- # An array with the texture file path and optionally the width and height.
368
- #
369
- # @overload texture=(image_rep)
370
- #
371
- # @param [Sketchup::ImageRep] image_rep The pixel data representing the
372
- # texture. (Added in SketchUp 2018)
373
- #
374
- # @version SketchUp 6.0
375
- def texture=(arg)
376
- end
377
-
378
- # The use_alpha? method tells if the material uses transparency.
379
- #
380
- # Note that this is not affected by the alpha value of the color object. Only
381
- # the .alpha value and transparent texture will make this method return true.
382
- #
383
- # @example
384
- # material = Sketchup.active_model.materials[0]
385
- # is_alpha = material.use_alpha?
386
- #
387
- # @return [Boolean]
388
- #
389
- # @version SketchUp 6.0
390
- def use_alpha?
391
- end
392
-
393
- # The write_thumbnail method writes a bitmap thumbnail to the given file name.
394
- #
395
- # @example
396
- # model = Sketchup.active_model
397
- # model.materials.each { |material|
398
- # thumbnail_file = "C:/tmp/materials/#{material.display_name}.png"
399
- # material.write_thumbnail(thumbnail_file, 128)
400
- # }
401
- #
402
- # @param [String] path
403
- # The file path for the thumbnail.
404
- #
405
- # @param [Integer] resolution
406
- # The resolution of the thumbnail.
407
- #
408
- # @return [Boolean] true if successful, false if unsuccessful.
409
- #
410
- # @version SketchUp 8.0 M1
411
- def write_thumbnail(path, resolution)
412
- end
413
-
414
- end
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The {Sketchup::Material} class represents a {Sketchup::Texture}
5
+ # or {Sketchup::Color} that can be applied to {Sketchup::Drawingelement}s.
6
+ # It is most often applied to {Sketchup::Face}s.
7
+ #
8
+ # You can pass any object that can be used as a material to a method that
9
+ # requires a material. Objects include actual {Sketchup::Material},
10
+ # {Sketchup::Color}, and classes that can be converted to a color.
11
+ #
12
+ # @example
13
+ # model = Sketchup.active_model
14
+ # face = model.entities.add_face([0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0])
15
+ # material = model.materials.add('Example')
16
+ # # The following will all assign a red material to the face:
17
+ # material.color = Sketchup::Color.new(255, 0, 0)
18
+ # face.material = material
19
+ # face.material = Sketchup::Color.new(255, 0, 0)
20
+ # face.material = [255, 0, 0]
21
+ # face.material = "red"
22
+ # face.material = 0xff0000
23
+ #
24
+ # @version SketchUp 6.0
25
+ class Sketchup::Material < Sketchup::Entity
26
+
27
+ # Includes
28
+
29
+ include Comparable
30
+
31
+ # Constants
32
+
33
+ COLORIZE_SHIFT = nil # Stub value.
34
+ COLORIZE_TINT = nil # Stub value.
35
+
36
+ MATERIAL_COLORIZED_TEXTURED = nil # Stub value.
37
+ MATERIAL_SOLID = nil # Stub value.
38
+ MATERIAL_TEXTURED = nil # Stub value.
39
+
40
+ NORMAL_STYLE_DIRECTX = nil # Stub value.
41
+ NORMAL_STYLE_OPENGL = nil # Stub value.
42
+
43
+ OWNER_IMAGE = nil # Stub value.
44
+ OWNER_LAYER = nil # Stub value.
45
+ OWNER_MANAGER = nil # Stub value.
46
+
47
+ WORKFLOW_CLASSIC = nil # Stub value.
48
+ WORKFLOW_PBR_METALLIC_ROUGHNESS = nil # Stub value.
49
+
50
+ # Instance Methods
51
+
52
+ # The {#<=>} method is used to compare two materials based on #{display_name}.
53
+ #
54
+ # @example
55
+ # materials = Sketchup.active_model.materials
56
+ # m1 = materials.add('Joe')
57
+ # m2 = materials.add('Fred')
58
+ # m1 <=> m2
59
+ # # > 1
60
+ #
61
+ # @param [Sketchup::Material] material
62
+ #
63
+ # @return [Integer] +0+ if they are equal,
64
+ # +1+ if material1 > material2, +-1+ if material1 < material2
65
+ #
66
+ # @version SketchUp 6.0
67
+ def <=>(material)
68
+ end
69
+
70
+ # The {#==} method is used to test if two materials are the same.
71
+ #
72
+ # @example
73
+ # model = Sketchup.active_model
74
+ # materials = model.materials
75
+ # m1 = materials.add('Joe')
76
+ # m2 = materials.add('Fred')
77
+ # m1 == m2
78
+ # # > false
79
+ #
80
+ # @param [Sketchup::Material] material
81
+ #
82
+ # @return [Boolean]
83
+ #
84
+ # @version SketchUp 6.0
85
+ def ==(material)
86
+ end
87
+
88
+ # The {#alpha} method is used to get the opacity of the material.
89
+ #
90
+ # The value will be between +0.0+ and +1.0+. A value of +0.0+ means that the
91
+ # material is completely transparent. A value of +1.0+ means that the material
92
+ # is completely opaque.
93
+ #
94
+ # @example
95
+ # material = Sketchup.active_model.materials.add('Example')
96
+ # material.alpha
97
+ # # > 1.0
98
+ #
99
+ # @return [Float] A value between +0.0+ and +1.0+.
100
+ #
101
+ # @see #use_alpha?
102
+ #
103
+ # @version SketchUp 6.0
104
+ def alpha
105
+ end
106
+
107
+ # The {#alpha=} method is used to set the opacity of the material.
108
+ #
109
+ # The value must be between +0.0+ and +1.0+. A value of +0.0+ means that the
110
+ # material is completely transparent. A value of +1.0+ means that the material
111
+ # is completely opaque.
112
+ #
113
+ # @example
114
+ # material = Sketchup.active_model.materials.add('Example')
115
+ # material.alpha = 0.5
116
+ #
117
+ # @param [Float] alpha
118
+ # An alpha value between +0.0+ and +1.0+.
119
+ #
120
+ # @return [Float]
121
+ #
122
+ # @see #use_alpha?
123
+ #
124
+ # @version SketchUp 6.0
125
+ def alpha=(alpha)
126
+ end
127
+
128
+ #
129
+ # @example
130
+ # material = Sketchup.active_model.materials.add("Material")
131
+ # material.ao_enabled = true
132
+ #
133
+ # @raise [ArgumentError] if the ambient occlusion texture is not set before enabling ambient
134
+ # occlusion.
135
+ #
136
+ # @see ao_enabled?
137
+ #
138
+ # @see #ao_texture
139
+ #
140
+ # @see #ao_texture=
141
+ #
142
+ # @see #ao_strength
143
+ #
144
+ # @see #ao_strength=
145
+ #
146
+ # @version SketchUp 2025.0.2
147
+ def ao_enabled=(enabled)
148
+ end
149
+
150
+ #
151
+ # @example
152
+ # material = Sketchup.active_model.materials.add("Material")
153
+ # material.ao_enabled?
154
+ # # > false
155
+ #
156
+ # @note There is no setter for this property. Instead it's dictated whether a
157
+ # {#ao_texture} is set.
158
+ #
159
+ # @return [Boolean]
160
+ #
161
+ # @see #ao_enabled=
162
+ #
163
+ # @see #ao_texture
164
+ #
165
+ # @see #ao_texture=
166
+ #
167
+ # @see #ao_strength
168
+ #
169
+ # @see #ao_strength=
170
+ #
171
+ # @version SketchUp 2025.0
172
+ def ao_enabled?
173
+ end
174
+
175
+ #
176
+ # @example
177
+ # material = Sketchup.active_model.materials.add("PBR Material")
178
+ # material.ao_texture = 'path/to/ao_texture.png'
179
+ # material.ao_strength
180
+ # # > 1.0
181
+ #
182
+ # @return [Float] A value between +0.0+ and +1.0+.
183
+ #
184
+ # @see #ao_enabled?
185
+ #
186
+ # @see #ao_texture
187
+ #
188
+ # @see #ao_texture=
189
+ #
190
+ # @version SketchUp 2025.0
191
+ def ao_strength
192
+ end
193
+
194
+ #
195
+ # @example
196
+ # material = Sketchup.active_model.materials.add("PBR Material")
197
+ # material.ao_texture = 'path/to/ao_texture.png'
198
+ # material.ao_strength = 1.0
199
+ #
200
+ # @param [Float] strenght
201
+ # A value between +0.0+ and +1.0+.
202
+ #
203
+ # @see #ao_enabled?
204
+ #
205
+ # @see #ao_texture
206
+ #
207
+ # @see #ao_texture=
208
+ #
209
+ # @version SketchUp 2025.0
210
+ def ao_strength=(strenght)
211
+ end
212
+
213
+ #
214
+ # @example
215
+ # material = Sketchup.active_model.materials.add("PBR Material")
216
+ # material.ao_texture = 'path/to/ao_texture.png'
217
+ # material.ao_texture
218
+ # # > nil
219
+ #
220
+ # @return [Sketchup::Texture]
221
+ #
222
+ # @see #ao_enabled?
223
+ #
224
+ # @see #ao_strength
225
+ #
226
+ # @see #ao_strength=
227
+ #
228
+ # @version SketchUp 2025.0
229
+ def ao_texture
230
+ end
231
+
232
+ #
233
+ # @example
234
+ # material = Sketchup.active_model.materials.add("PBR Material")
235
+ # material.texture = 'path/to/texture.png'
236
+ # material.ao_texture = 'path/to/ao_texture.png'
237
+ #
238
+ # @overload ao_texture=(image_path)
239
+ #
240
+ # @param [String] image_path
241
+ #
242
+ # @overload ao_texture=(image_rep)
243
+ #
244
+ # @param [Sketchup::ImageRep] image_rep
245
+ #
246
+ # @overload ao_texture=(texture)
247
+ #
248
+ # Copies another texture to this texture.
249
+ # @param [Sketchup::Texture] texture
250
+ #
251
+ # @raise [ArgumentError] if the image data of the texture is invalid or corrupt.
252
+ #
253
+ # @see #ao_enabled?
254
+ #
255
+ # @see #ao_strength
256
+ #
257
+ # @see #ao_strength=
258
+ #
259
+ # @version SketchUp 2025.0
260
+ def ao_texture=(texture)
261
+ end
262
+
263
+ # The {#color} method is used to retrieve the color of the material.
264
+ #
265
+ # If it uses a colorized {Sketchup::Texture}, this will return the average
266
+ # color of the texture.
267
+ #
268
+ # @example
269
+ # materials = Sketchup.active_model.materials.add('Example')
270
+ # material.color = 'red'
271
+ # color = material.color
272
+ #
273
+ # @note The alpha value of the {Sketchup::Color} object is not used for the
274
+ # material's transparency. This is controlled by the {#alpha} property in
275
+ # order for textured materials to also have transparency.
276
+ #
277
+ # @return [Sketchup::Color]
278
+ #
279
+ # @see #alpha
280
+ #
281
+ # @see #texture
282
+ #
283
+ # @version SketchUp 6.0
284
+ def color
285
+ end
286
+
287
+ # The {#color=} method is used to set the color of the material.
288
+ #
289
+ # If the material has a {Sketchup::Texture}, then this turns it into a colorized
290
+ # texture.
291
+ #
292
+ # To reset the color of a material with a colorized texture, set the color
293
+ # to +nil+. If the texture is not colorized it'll be reset to some undefined
294
+ # default color.
295
+ #
296
+ # @example
297
+ # model = Sketchup.active_model
298
+ # materials = model.materials
299
+ # material = materials.add('Joe')
300
+ # material.color = 'red'
301
+ #
302
+ # @note The alpha value of the {Sketchup::Color} object is not used for the
303
+ # material's transparency. This is controlled by the {#alpha} property in
304
+ # order for textured materials to also have transparency.
305
+ #
306
+ # @param [Sketchup::Color, String, Array(Numeric, Numeric, Numeric, Numeric), Integer, nil] color
307
+ # Any value you can create a {Sketchup::Color} from or +nil+.
308
+ #
309
+ # @see #alpha=
310
+ #
311
+ # @see #texture=
312
+ #
313
+ # @see #colorize_deltas
314
+ #
315
+ # @see #colorize_type
316
+ #
317
+ # @see #materialType
318
+ #
319
+ # @see Sketchup::Color#initialize
320
+ #
321
+ # @version SketchUp 6.0
322
+ def color=(color)
323
+ end
324
+
325
+ # The {#colorize_deltas} method retrieves the HLS delta for colorized materials.
326
+ #
327
+ # @example
328
+ # material = Sketchup.active_model.materials.add('Example')
329
+ # h, l, s = material.colorize_deltas
330
+ #
331
+ # @return [Array(Float, Float, Float)] An array of floats representing the HLS delta.
332
+ #
333
+ # @version SketchUp 2015
334
+ def colorize_deltas
335
+ end
336
+
337
+ # The {#colorize_type} method retrieves the type of colorization of the material.
338
+ #
339
+ # {Material Colorize Types}[#normal_style_summary]:
340
+ #
341
+ # - {Sketchup::Material::COLORIZE_SHIFT}
342
+ # - {Sketchup::Material::COLORIZE_TINT}
343
+ #
344
+ # @example
345
+ # material = Sketchup.active_model.materials.add('Example')
346
+ # type = material.colorize_type
347
+ #
348
+ # @note This value is only relevant when the {#materialType} is set to
349
+ # {Sketchup::Material::MATERIAL_COLORIZED_TEXTURED}.
350
+ #
351
+ # @return [Integer] One of +Sketchup::Material::COLORIZE_*+ values.
352
+ #
353
+ # @version SketchUp 2015
354
+ def colorize_type
355
+ end
356
+
357
+ # The {#colorize_type=} method set the type of colorization of the material.
358
+ #
359
+ # {Material Colorize Types}[#normal_style_summary]:
360
+ #
361
+ # - {Sketchup::Material::COLORIZE_SHIFT}
362
+ # - {Sketchup::Material::COLORIZE_TINT}
363
+ #
364
+ # @example
365
+ # material = Sketchup.active_model.materials.add('Example')
366
+ # material.colorize_type = Sketchup::Material::COLORIZE_TINT
367
+ #
368
+ # @note This value is only relevant when the {#materialType} is set to
369
+ # {Sketchup::Material::MATERIAL_COLORIZED_TEXTURED}.
370
+ #
371
+ # @param [Integer] type
372
+ # One of +Sketchup::Material::COLORIZE_*+ values.
373
+ #
374
+ # @version SketchUp 2015
375
+ def colorize_type=(type)
376
+ end
377
+
378
+ # The {#display_name} method retrieves the name that is displayed within SketchUp
379
+ # for the material.
380
+ #
381
+ # This should be used when presenting the name in the UI, but the returned name
382
+ # cannot be used as a key in {Sketchup::Model#materials}.
383
+ #
384
+ # @example
385
+ # model = Sketchup.active_model
386
+ # materials = model.materials
387
+ # material = materials.add('[Joe]')
388
+ # # Use .name for the internal name of a material
389
+ # puts material.name # Outputs "[Joe]"
390
+ # # Use .display_name for presenting the material name
391
+ # # to the UI like SketchUp does.
392
+ # puts material.display_name # Outputs "Joe"
393
+ #
394
+ # @return [String]
395
+ #
396
+ # @see #name
397
+ #
398
+ # @version SketchUp 6.0
399
+ def display_name
400
+ end
401
+
402
+ # The {#materialType} method retrieves the type of the material.
403
+ #
404
+ # {Material Types}[#material_type_constant_summary]:
405
+ #
406
+ # - +0+ = solid ({Sketchup::Material::MATERIAL_SOLID})
407
+ # - +1+ = textured ({Sketchup::Material::MATERIAL_TEXTURED})
408
+ # - +2+ = colorized textured ({Sketchup::Material::MATERIAL_COLORIZED_TEXTURED})
409
+ #
410
+ # The constants were added in SketchUp 2015.
411
+ #
412
+ # @example
413
+ # material = Sketchup.active_model.materials.add('Example')
414
+ # material.materialType == Sketchup::Material::MATERIAL_SOLID
415
+ # # > true
416
+ #
417
+ # @return [Integer] One of +Sketchup::Material::MATERIAL_*+ values.
418
+ #
419
+ # @version SketchUp 6.0
420
+ def materialType
421
+ end
422
+
423
+ #
424
+ # @example
425
+ # material = Sketchup.active_model.materials.add("PBR Material")
426
+ # material.metalness_enabled = true
427
+ # material.metallic_factor
428
+ # # > 1.0
429
+ #
430
+ # @return [Float] A value between +0.0+ and +1.0+.
431
+ #
432
+ # @see #metalness_enabled?
433
+ #
434
+ # @see #metalness_enabled=
435
+ #
436
+ # @see #metallic_texture
437
+ #
438
+ # @see #metallic_texture=
439
+ #
440
+ # @version SketchUp 2025.0
441
+ def metallic_factor
442
+ end
443
+
444
+ #
445
+ # @example
446
+ # material = Sketchup.active_model.materials.add("PBR Material")
447
+ # material.metalness_enabled = true
448
+ # material.metallic_factor = 1.0
449
+ #
450
+ # @param [Float] factor
451
+ # A value between +0.0+ and +1.0+.
452
+ #
453
+ # @see #metalness_enabled?
454
+ #
455
+ # @see #metalness_enabled=
456
+ #
457
+ # @see #metallic_texture
458
+ #
459
+ # @see #metallic_texture=
460
+ #
461
+ # @version SketchUp 2025.0
462
+ def metallic_factor=(factor)
463
+ end
464
+
465
+ #
466
+ # @example
467
+ # material = Sketchup.active_model.materials.add("PBR Material")
468
+ # material.metalness_enabled = true
469
+ # material.metallic_texture
470
+ # # > nil
471
+ #
472
+ # @return [Sketchup::Texture]
473
+ #
474
+ # @see #metalness_enabled?
475
+ #
476
+ # @see #metalness_enabled=
477
+ #
478
+ # @see #metallic_factor
479
+ #
480
+ # @see #metallic_factor=
481
+ #
482
+ # @version SketchUp 2025.0
483
+ def metallic_texture
484
+ end
485
+
486
+ #
487
+ # @example
488
+ # material = Sketchup.active_model.materials.add("PBR Material")
489
+ # material.texture = 'path/to/texture.png'
490
+ # material.metallic_texture = 'path/to/metallic_texture.png'
491
+ #
492
+ # @overload metallic_texture=(image_path)
493
+ #
494
+ # @param [String] image_path
495
+ #
496
+ # @overload metallic_texture=(image_rep)
497
+ #
498
+ # @param [Sketchup::ImageRep] image_rep
499
+ #
500
+ # @overload metallic_texture=(texture)
501
+ #
502
+ # Copies another texture to this texture.
503
+ # @param [Sketchup::Texture] texture
504
+ #
505
+ # @raise [ArgumentError] if the image data of the texture is invalid or corrupt.
506
+ #
507
+ # @see #metalness_enabled?
508
+ #
509
+ # @see #metalness_enabled=
510
+ #
511
+ # @see #metallic_factor
512
+ #
513
+ # @see #metallic_factor=
514
+ #
515
+ # @version SketchUp 2025.0
516
+ def metallic_texture=(texture)
517
+ end
518
+
519
+ #
520
+ # @example
521
+ # material = Sketchup.active_model.materials.add("PBR Material")
522
+ # material.metalness_enabled = true
523
+ #
524
+ # @param [Boolean] enabled
525
+ #
526
+ # @see #metallic_texture
527
+ #
528
+ # @see #metallic_texture=
529
+ #
530
+ # @see #metallic_factor
531
+ #
532
+ # @see #metallic_factor=
533
+ #
534
+ # @version SketchUp 2025.0
535
+ def metalness_enabled=(enabled)
536
+ end
537
+
538
+ #
539
+ # @example
540
+ # material = Sketchup.active_model.materials.add("Material")
541
+ # material.metalness_enabled?
542
+ # # > false
543
+ #
544
+ # @return [Boolean]
545
+ #
546
+ # @see #metallic_texture
547
+ #
548
+ # @see #metallic_texture=
549
+ #
550
+ # @see #metallic_factor
551
+ #
552
+ # @see #metallic_factor=
553
+ #
554
+ # @version SketchUp 2025.0
555
+ def metalness_enabled?
556
+ end
557
+
558
+ # The {#name} method retrieves the name of the material. This is the
559
+ # unique internal name of the object which should be used for retrieving
560
+ # the material from the model's material list.
561
+ #
562
+ # Use {#display_name} to display the name in the UI.
563
+ #
564
+ # @example
565
+ # model = Sketchup.active_model
566
+ # materials = model.materials
567
+ # material = materials.add('[Joe]')
568
+ # # Use .name for the internal name of a material
569
+ # puts material.name # Outputs "[Joe]"
570
+ # # Use .display_name for presenting the material name
571
+ # # to the UI like SketchUp does.
572
+ # puts material.display_name # Outputs "Joe"
573
+ #
574
+ # @return [String]
575
+ #
576
+ # @see #display_name
577
+ #
578
+ # @version SketchUp 6.0
579
+ def name
580
+ end
581
+
582
+ # The {#name=} method sets the name of the material.
583
+ #
584
+ # @bug SketchUp 2018 would raise an error if you named material the name it
585
+ # already had.
586
+ #
587
+ # @example Safely change name without raising errors
588
+ # materials = Sketchup.active_model.materials
589
+ # material = materials.add("Joe")
590
+ # material.name = materials.unique_name('Jeff')
591
+ #
592
+ # @note Since SketchUp 2018 this method will raise an +ArgumentError+ if the
593
+ # name is not unique.
594
+ #
595
+ # @param [String] str
596
+ # the new material name
597
+ #
598
+ # @raise [ArgumentError] if the name is not unique to the model.
599
+ # (Added in SU2018)
600
+ #
601
+ # @return [String]
602
+ #
603
+ # @version SketchUp 8.0 M1
604
+ def name=(str)
605
+ end
606
+
607
+ #
608
+ # @example
609
+ # material = Sketchup.active_model.materials.add("PBR Material")
610
+ # material.normal_enabled = true
611
+ #
612
+ # @param [Boolean] enabled
613
+ #
614
+ # @raise [ArgumentError] if the normal texture is not set before enabling normal mapping.
615
+ #
616
+ # @see #normal_enabled?
617
+ #
618
+ # @see #normal_texture
619
+ #
620
+ # @see #normal_texture=
621
+ #
622
+ # @see #normal_scale
623
+ #
624
+ # @see #normal_scale=
625
+ #
626
+ # @see #normal_style
627
+ #
628
+ # @see #normal_style=
629
+ #
630
+ # @version SketchUp 2025.0.2
631
+ def normal_enabled=(enabled)
632
+ end
633
+
634
+ #
635
+ # @example
636
+ # material = Sketchup.active_model.materials.add("Material")
637
+ # material.normal_enabled?
638
+ # # > false
639
+ #
640
+ # @return [Boolean]
641
+ #
642
+ # @see #normal_enabled=
643
+ #
644
+ # @see #normal_texture
645
+ #
646
+ # @see #normal_texture=
647
+ #
648
+ # @see #normal_scale
649
+ #
650
+ # @see #normal_scale=
651
+ #
652
+ # @see #normal_style
653
+ #
654
+ # @see #normal_style=
655
+ #
656
+ # @version SketchUp 2025.0
657
+ def normal_enabled?
658
+ end
659
+
660
+ #
661
+ # @example
662
+ # material = Sketchup.active_model.materials.add("PBR Material")
663
+ # material.normal_texture = 'path/to/normal_texture.png'
664
+ # material.normal_scale
665
+ # # > 1.0
666
+ #
667
+ # @return [Float] A value larger than or equal to +0.0+.
668
+ #
669
+ # @see #normal_enabled?
670
+ #
671
+ # @see #normal_texture
672
+ #
673
+ # @see #normal_texture=
674
+ #
675
+ # @see #normal_style
676
+ #
677
+ # @see #normal_style=
678
+ #
679
+ # @version SketchUp 2025.0
680
+ def normal_scale
681
+ end
682
+
683
+ #
684
+ # @example
685
+ # material = Sketchup.active_model.materials.add("PBR Material")
686
+ # material.normal_texture = 'path/to/normal_texture.png'
687
+ # material.normal_scale = 1.0
688
+ #
689
+ # @param [Float] scale
690
+ # A value larger than or equal to +0.0+.
691
+ #
692
+ # @see #normal_enabled?
693
+ #
694
+ # @see #normal_texture
695
+ #
696
+ # @see #normal_texture=
697
+ #
698
+ # @see #normal_style
699
+ #
700
+ # @see #normal_style=
701
+ #
702
+ # @version SketchUp 2025.0
703
+ def normal_scale=(scale)
704
+ end
705
+
706
+ # {Material Normal Styles}[#normal_style_summary]:
707
+ #
708
+ # - {NORMAL_STYLE_OPENGL}
709
+ # - {NORMAL_STYLE_DIRECTX}
710
+ #
711
+ # @example
712
+ # material = Sketchup.active_model.materials.add("PBR Material")
713
+ # material.normal_texture = 'path/to/normal_texture.png'
714
+ # material.normal_style
715
+ # # > Sketchup::Material::NORMAL_STYLE_OPENGL
716
+ #
717
+ # @return [Integer] One of +Sketchup::Material::NORMAL_STYLE_*+ values.
718
+ #
719
+ # @see #normal_enabled?
720
+ #
721
+ # @see #normal_texture
722
+ #
723
+ # @see #normal_texture=
724
+ #
725
+ # @see #normal_scale
726
+ #
727
+ # @see #normal_scale=
728
+ #
729
+ # @version SketchUp 2025.0
730
+ def normal_style
731
+ end
732
+
733
+ # {Material Normal Styles}[#normal_style_summary]:
734
+ #
735
+ # - {NORMAL_STYLE_OPENGL}
736
+ # - {NORMAL_STYLE_DIRECTX}
737
+ #
738
+ # @example
739
+ # material = Sketchup.active_model.materials.add("PBR Material")
740
+ # material.normal_texture = 'path/to/normal_texture.png'
741
+ # material.normal_style = Sketchup::Material::NORMAL_STYLE_DIRECTX
742
+ #
743
+ # @param [Integer] style
744
+ #
745
+ # @see #normal_enabled?
746
+ #
747
+ # @see #normal_texture
748
+ #
749
+ # @see #normal_texture=
750
+ #
751
+ # @see #normal_scale
752
+ #
753
+ # @see #normal_scale=
754
+ #
755
+ # @version SketchUp 2025.0
756
+ def normal_style=(style)
757
+ end
758
+
759
+ #
760
+ # @example
761
+ # material = Sketchup.active_model.materials.add("PBR Material")
762
+ # material.normal_texture = 'path/to/normal_texture.png'
763
+ # material.normal_texture
764
+ # # > #<Sketchup::Texture>
765
+ #
766
+ # @return [Sketchup::Texture]
767
+ #
768
+ # @see #normal_enabled?
769
+ #
770
+ # @see #normal_scale
771
+ #
772
+ # @see #normal_scale=
773
+ #
774
+ # @see #normal_style
775
+ #
776
+ # @see #normal_style=
777
+ #
778
+ # @version SketchUp 2025.0
779
+ def normal_texture
780
+ end
781
+
782
+ #
783
+ # @example
784
+ # material = Sketchup.active_model.materials.add("PBR Material")
785
+ # material.texture = 'path/to/texture.png'
786
+ # material.normal_texture = 'path/to/normal_texture.png'
787
+ #
788
+ # @overload normal_texture=(image_path)
789
+ #
790
+ # @param [String] image_path
791
+ #
792
+ # @overload normal_texture=(image_rep)
793
+ #
794
+ # @param [Sketchup::ImageRep] image_rep
795
+ #
796
+ # @overload normal_texture=(texture)
797
+ #
798
+ # Copies another texture to this texture.
799
+ # @param [Sketchup::Texture] texture
800
+ #
801
+ # @raise [ArgumentError] if the image data of the texture is invalid or corrupt.
802
+ #
803
+ # @raise [ArgumentError] if the image data is not 24 bits per pixels or higher.
804
+ #
805
+ # @see #normal_enabled?
806
+ #
807
+ # @see #normal_scale
808
+ #
809
+ # @see #normal_scale=
810
+ #
811
+ # @see #normal_style
812
+ #
813
+ # @see #normal_style=
814
+ #
815
+ # @version SketchUp 2025.0
816
+ def normal_texture=(texture)
817
+ end
818
+
819
+ # The {#owner_type} method is used to determine what owns the material.
820
+ #
821
+ # {Material Owner Types}[#owner_type_constant_summary]:
822
+ #
823
+ # - {Sketchup::Material::OWNER_MANAGER}
824
+ # - {Sketchup::Material::OWNER_IMAGE}
825
+ # - {Sketchup::Material::OWNER_LAYER}
826
+ #
827
+ # @return [Integer]
828
+ #
829
+ # @version SketchUp 2019.2
830
+ def owner_type
831
+ end
832
+
833
+ #
834
+ # @example
835
+ # material = Sketchup.active_model.materials.add("PBR Material")
836
+ # material.roughness_enabled = true
837
+ #
838
+ # @param [Boolean] enabled
839
+ #
840
+ # @see #roughness_texture
841
+ #
842
+ # @see #roughness_texture=
843
+ #
844
+ # @see #roughness_factor
845
+ #
846
+ # @see #roughness_factor=
847
+ #
848
+ # @version SketchUp 2025.0
849
+ def roughness_enabled=(enabled)
850
+ end
851
+
852
+ #
853
+ # @example
854
+ # material = Sketchup.active_model.materials.add("Material")
855
+ # material.roughness_enabled?
856
+ # # > false
857
+ #
858
+ # @return [Boolean]
859
+ #
860
+ # @see #roughness_texture
861
+ #
862
+ # @see #roughness_texture=
863
+ #
864
+ # @see #roughness_factor
865
+ #
866
+ # @see #roughness_factor=
867
+ #
868
+ # @version SketchUp 2025.0
869
+ def roughness_enabled?
870
+ end
871
+
872
+ #
873
+ # @example
874
+ # material = Sketchup.active_model.materials.add("PBR Material")
875
+ # material.roughness_enabled = true
876
+ # material.roughness_factor
877
+ # # > 1.0
878
+ #
879
+ # @return [Float] A value between +0.0+ and +1.0+.
880
+ #
881
+ # @see #roughness_enabled?
882
+ #
883
+ # @see #roughness_enabled=
884
+ #
885
+ # @see #roughness_texture
886
+ #
887
+ # @see #roughness_texture=
888
+ #
889
+ # @version SketchUp 2025.0
890
+ def roughness_factor
891
+ end
892
+
893
+ #
894
+ # @example
895
+ # material = Sketchup.active_model.materials.add("PBR Material")
896
+ # material.roughness_enabled = true
897
+ # material.roughness_factor = 1.0
898
+ #
899
+ # @param [Float] factor
900
+ # A value between +0.0+ and +1.0+.
901
+ #
902
+ # @see #roughness_enabled?
903
+ #
904
+ # @see #roughness_enabled=
905
+ #
906
+ # @see #roughness_texture
907
+ #
908
+ # @see #roughness_texture=
909
+ #
910
+ # @version SketchUp 2025.0
911
+ def roughness_factor=(factor)
912
+ end
913
+
914
+ #
915
+ # @example
916
+ # material = Sketchup.active_model.materials.add("PBR Material")
917
+ # material.roughness_enabled = true
918
+ # material.roughness_texture
919
+ # # > nil
920
+ #
921
+ # @return [Sketchup::Texture]
922
+ #
923
+ # @see #roughness_enabled?
924
+ #
925
+ # @see #roughness_enabled=
926
+ #
927
+ # @see #roughness_factor
928
+ #
929
+ # @see #roughness_factor=
930
+ #
931
+ # @version SketchUp 2025.0
932
+ def roughness_texture
933
+ end
934
+
935
+ #
936
+ # @example
937
+ # material = Sketchup.active_model.materials.add("PBR Material")
938
+ # material.texture = 'path/to/texture.png'
939
+ # material.roughness_texture = 'path/to/roughness_texture.png'
940
+ #
941
+ # @overload roughness_texture=(image_path)
942
+ #
943
+ # @param [String] image_path
944
+ #
945
+ # @overload roughness_texture=(image_rep)
946
+ #
947
+ # @param [Sketchup::ImageRep] image_rep
948
+ #
949
+ # @overload roughness_texture=(texture)
950
+ #
951
+ # Copies another texture to this texture.
952
+ # @param [Sketchup::Texture] texture
953
+ #
954
+ # @raise [ArgumentError] if the image data of the texture is invalid or corrupt.
955
+ #
956
+ # @see #roughness_enabled?
957
+ #
958
+ # @see #roughness_enabled=
959
+ #
960
+ # @see #roughness_factor
961
+ #
962
+ # @see #roughness_factor=
963
+ #
964
+ # @version SketchUp 2025.0
965
+ def roughness_texture=(texture)
966
+ end
967
+
968
+ # The {#save_as} method is used to write a material to a SKM file.
969
+ #
970
+ # @example
971
+ # filename = File.join(Sketchup.temp_dir, 'su_test.skm')
972
+ # materials = Sketchup.active_model.materials
973
+ # material = materials.add("Hello World")
974
+ # material.color = 'red'
975
+ # material.save_as(filename)
976
+ #
977
+ # @note You must remember to append ".skm" to the filename as this will not be
978
+ # done automatically.
979
+ #
980
+ # @param [String] filename
981
+ # the path to the SKM file to load.
982
+ #
983
+ # @return [Boolean]
984
+ #
985
+ # @version SketchUp 2017
986
+ def save_as(filename)
987
+ end
988
+
989
+ # The {#texture} method retrieves the texture of the material.
990
+ #
991
+ # @example
992
+ # model = Sketchup.active_model
993
+ # materials = model.materials
994
+ # material = materials.add('Joe')
995
+ # material.texture = 'path/to/metallic_texture.png'
996
+ # texture = material.texture
997
+ #
998
+ # @return [Sketchup::Texture, nil]
999
+ #
1000
+ # @version SketchUp 6.0
1001
+ def texture
1002
+ end
1003
+
1004
+ # The {#texture=} method sets the texture for the material.
1005
+ #
1006
+ # Setting the texture to +nil+ will turn remove it and the material will use
1007
+ # {#color}.
1008
+ #
1009
+ # @example
1010
+ # model = Sketchup.active_model
1011
+ # materials = model.materials
1012
+ # material = materials.add('Joe')
1013
+ # material.texture = 'path/to/metallic_texture.png'
1014
+ #
1015
+ # @overload texture=(filename)
1016
+ #
1017
+ # @param [String] filename
1018
+ # The file path to the texture the material should use.
1019
+ #
1020
+ # @overload texture=(properties)
1021
+ #
1022
+ # @param [Array(String, Length, Length)] properties
1023
+ # An array with the texture file path and optionally a width and height
1024
+ # which sets {Sketchup::Texture#width} and {Sketchup::Texture#height}.
1025
+ #
1026
+ # @overload texture=(properties)
1027
+ #
1028
+ # @param [Array(String, Length)] properties
1029
+ # An array with the texture file path and optionally a size
1030
+ # which sets {Sketchup::Texture#width} and {Sketchup::Texture#height}.
1031
+ #
1032
+ # @overload texture=(image_rep)
1033
+ #
1034
+ # @version SketchUp 2018
1035
+ # @param [Sketchup::ImageRep] image_rep The pixel data representing the
1036
+ # texture.
1037
+ #
1038
+ # @version SketchUp 6.0
1039
+ def texture=(arg)
1040
+ end
1041
+
1042
+ # The {#use_alpha?} method tells if the material uses transparency. It uses
1043
+ # some tolerance checking to account for floating point precision noise.
1044
+ #
1045
+ # @example
1046
+ # material = Sketchup.active_model.materials.add('Example')
1047
+ # material.use_alpha?
1048
+ # # > false
1049
+ #
1050
+ # material.alpha = 0.5
1051
+ # material.use_alpha?
1052
+ # # > true
1053
+ #
1054
+ # @note that this is not affected by the alpha value of the {#color} object.
1055
+ # Only the {#alpha} value will make this method return +true+.
1056
+ #
1057
+ # @return [Boolean]
1058
+ #
1059
+ # @see #alpha
1060
+ #
1061
+ # @see #alpha=
1062
+ #
1063
+ # @version SketchUp 6.0
1064
+ def use_alpha?
1065
+ end
1066
+
1067
+ # {Material Workflows}[#workflow_constant_summary]:
1068
+ #
1069
+ # - {WORKFLOW_CLASSIC}
1070
+ # - {WORKFLOW_PBR_METALLIC_ROUGHNESS}
1071
+ #
1072
+ # When the workflow returns +WORKFLOW_PBR_METALLIC_ROUGHNESS+ the properties
1073
+ # listed under {PBR Metallic Roughness Workflow}[#pbr_metallic_roughness_workflow]
1074
+ # are relevant.
1075
+ #
1076
+ # @example Classic material
1077
+ # material = Sketchup.active_model.materials.add("Material")
1078
+ # workflow = material.workflow
1079
+ # # > workflow == Sketchup::Material::WORKFLOW_CLASSIC
1080
+ #
1081
+ # @example PBR material
1082
+ # material = Sketchup.active_model.materials.add("PBR Material")
1083
+ # material.metalness_enabled = true # Or any of the other PBR properties.
1084
+ # workflow = material.workflow
1085
+ # # > workflow == Sketchup::Material::WORKFLOW_PBR_METALLIC_ROUGHNESS
1086
+ #
1087
+ # @return [Integer] One of +Sketchup::Material::WORKFLOW_*+ values.
1088
+ #
1089
+ # @version SketchUp 2025.0
1090
+ def workflow
1091
+ end
1092
+
1093
+ # The {#write_thumbnail} method writes a bitmap thumbnail to the given file name.
1094
+ #
1095
+ # @example
1096
+ # model = Sketchup.active_model
1097
+ # model.materials.each { |material|
1098
+ # thumbnail_file = File.join(Sketchup.temp_dir, "#{material.display_name}.png")
1099
+ # material.write_thumbnail(thumbnail_file, 128)
1100
+ # }
1101
+ #
1102
+ # @param [String] path
1103
+ # The file path for the thumbnail.
1104
+ #
1105
+ # @param [Integer] max_size
1106
+ # The maximum width or height of the generated image.
1107
+ #
1108
+ # @return [Boolean, nil] +true+ if successful, +false+ if unsuccessful.
1109
+ # +nil+ if arguments are invalid.
1110
+ #
1111
+ # @version SketchUp 8.0 M1
1112
+ def write_thumbnail(path, max_size)
1113
+ end
1114
+
1115
+ end