sketchup-api-stubs 0.7.10 → 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 (159) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +6 -0
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +1 -1
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +2 -2
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +25 -15
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +17 -32
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +62 -39
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +136 -104
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +56 -30
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +76 -52
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +35 -31
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +8 -16
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +135 -110
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +207 -222
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +6 -6
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +1 -1
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +11 -7
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +124 -10
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +112 -4
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +4 -4
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +56 -9
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +100 -1
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +13 -14
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +5 -3
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +1 -1
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +1 -1
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +47 -1
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +9 -1
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +65 -13
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -7
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +16 -3
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +13 -13
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +8 -14
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +10 -15
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +2 -2
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +28 -14
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +15 -8
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +7 -12
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +4 -10
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +17 -15
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +17 -17
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +3 -3
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +11 -14
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +2 -2
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +10 -10
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +59 -19
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +1 -1
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +3 -3
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
  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 +3 -6
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +94 -25
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +2 -2
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +16 -26
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +24 -17
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +11 -9
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +4 -67
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +2 -2
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +2 -2
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +34 -8
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -3
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +14 -8
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +3 -45
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -19
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -9
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +10 -3
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -1
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +831 -130
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +35 -22
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +146 -88
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +20 -5
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +14 -11
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +1 -1
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +17 -44
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +1 -13
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +158 -16
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +48 -21
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +61 -40
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +13 -1
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +84 -91
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -2
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +9 -5
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +20 -1
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +59 -13
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +29 -8
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -31
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +9 -9
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +229 -139
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +23 -22
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +336 -99
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +34 -8
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +71 -36
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +11 -11
  151. data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +21 -9
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +80 -5
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +14 -3
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +20 -3
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +9 -6
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +77 -14
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +7 -7
  159. metadata +10 -24
@@ -1,17 +1,23 @@
1
- # Copyright:: Copyright 2024 Trimble Inc.
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
- # The Material class represents a texture or color that can be applied to
5
- # Drawingelements. It is most often applied to Faces.
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.
6
7
  #
7
8
  # 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.)
9
+ # requires a material. Objects include actual {Sketchup::Material},
10
+ # {Sketchup::Color}, and classes that can be converted to a color.
12
11
  #
13
12
  # @example
14
- # face.material = mat1
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]
15
21
  # face.material = "red"
16
22
  # face.material = 0xff0000
17
23
  #
@@ -31,115 +37,261 @@ class Sketchup::Material < Sketchup::Entity
31
37
  MATERIAL_SOLID = nil # Stub value.
32
38
  MATERIAL_TEXTURED = nil # Stub value.
33
39
 
40
+ NORMAL_STYLE_DIRECTX = nil # Stub value.
41
+ NORMAL_STYLE_OPENGL = nil # Stub value.
42
+
34
43
  OWNER_IMAGE = nil # Stub value.
35
44
  OWNER_LAYER = nil # Stub value.
36
45
  OWNER_MANAGER = nil # Stub value.
37
46
 
47
+ WORKFLOW_CLASSIC = nil # Stub value.
48
+ WORKFLOW_PBR_METALLIC_ROUGHNESS = nil # Stub value.
49
+
38
50
  # Instance Methods
39
51
 
40
- # The <=> method is used to compare two materials based on name. The number
41
- # returned relates to the "string distance" between the names.
52
+ # The {#<=>} method is used to compare two materials based on #{display_name}.
42
53
  #
43
54
  # @example
44
- # model = Sketchup.active_model
45
- # materials = model.materials
55
+ # materials = Sketchup.active_model.materials
46
56
  # m1 = materials.add('Joe')
47
57
  # m2 = materials.add('Fred')
48
- # p m1 <=> m2
58
+ # m1 <=> m2
59
+ # # > 1
49
60
  #
50
- # @param [Sketchup::Material] material2
51
- # A Material object.
61
+ # @param [Sketchup::Material] material
52
62
  #
53
- # @return [Integer] 0 if they are equal, positive number if
54
- # material1 > material2, negative if material1 < material2
63
+ # @return [Integer] +0+ if they are equal,
64
+ # +1+ if material1 > material2, +-1+ if material1 < material2
55
65
  #
56
66
  # @version SketchUp 6.0
57
- def <=>(material2)
67
+ def <=>(material)
58
68
  end
59
69
 
60
- # The == method is used to test if two materials are the same.
70
+ # The {#==} method is used to test if two materials are the same.
61
71
  #
62
72
  # @example
63
73
  # model = Sketchup.active_model
64
74
  # materials = model.materials
65
75
  # m1 = materials.add('Joe')
66
76
  # 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
77
+ # m1 == m2
78
+ # # > false
72
79
  #
73
- # @param [Sketchup::Material] material2
74
- # A Material object.
80
+ # @param [Sketchup::Material] material
75
81
  #
76
- # @return [Boolean] true if the materials are the same, false if
77
- # they are different
82
+ # @return [Boolean]
78
83
  #
79
84
  # @version SketchUp 6.0
80
- def ==(material2)
85
+ def ==(material)
81
86
  end
82
87
 
83
- # The alpha method is used to get the opacity of the material.
88
+ # The {#alpha} method is used to get the opacity of the material.
84
89
  #
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.
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.
88
93
  #
89
94
  # @example
90
- # alpha_value = Sketchup.active_model.materials[0].alpha
95
+ # material = Sketchup.active_model.materials.add('Example')
96
+ # material.alpha
97
+ # # > 1.0
91
98
  #
92
- # @return [Float] a number between 0 and 1
99
+ # @return [Float] A value between +0.0+ and +1.0+.
100
+ #
101
+ # @see #use_alpha?
93
102
  #
94
103
  # @version SketchUp 6.0
95
104
  def alpha
96
105
  end
97
106
 
98
- # The alpha= method is used to set the opacity of the material.
107
+ # The {#alpha=} method is used to set the opacity of the material.
99
108
  #
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.
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.
103
112
  #
104
113
  # @example
105
- # model = Sketchup.active_model
106
- # materials = model.materials
107
- # material = materials.add('Joe')
114
+ # material = Sketchup.active_model.materials.add('Example')
108
115
  # material.alpha = 0.5
109
116
  #
110
117
  # @param [Float] alpha
111
- # An opacity value.
118
+ # An alpha value between +0.0+ and +1.0+.
119
+ #
120
+ # @return [Float]
112
121
  #
113
- # @return [Float] the newly set opacity value
122
+ # @see #use_alpha?
114
123
  #
115
124
  # @version SketchUp 6.0
116
125
  def alpha=(alpha)
117
126
  end
118
127
 
119
- # The color method is used to retrieve the color of the material.
120
128
  #
121
- # If it uses a Texture, this will return the average color.
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
+
122
150
  #
123
151
  # @example
124
- # model = Sketchup.active_model
125
- # materials = model.materials
126
- # material = materials.add('Joe')
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')
127
270
  # material.color = 'red'
128
271
  # color = material.color
129
272
  #
130
- # @return [Sketchup::Color] a Color object
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
131
282
  #
132
283
  # @version SketchUp 6.0
133
284
  def color
134
285
  end
135
286
 
136
- # The color= method is used to set the color of the material.
287
+ # The {#color=} method is used to set the color of the material.
137
288
  #
138
- # If the Material has a texture, then this turns it into a colorized
289
+ # If the material has a {Sketchup::Texture}, then this turns it into a colorized
139
290
  # texture.
140
291
  #
141
- # To reset the color of a Material with a texture, set the color
142
- # to nil.
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.
143
295
  #
144
296
  # @example
145
297
  # model = Sketchup.active_model
@@ -147,19 +299,33 @@ class Sketchup::Material < Sketchup::Entity
147
299
  # material = materials.add('Joe')
148
300
  # material.color = 'red'
149
301
  #
150
- # @param [Sketchup::Color, String, nil] color
151
- # A Color object.
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=
152
310
  #
153
- # @return [Sketchup::Color, String, nil] the newly set Color object
311
+ # @see #texture=
312
+ #
313
+ # @see #colorize_deltas
314
+ #
315
+ # @see #colorize_type
316
+ #
317
+ # @see #materialType
318
+ #
319
+ # @see Sketchup::Color#initialize
154
320
  #
155
321
  # @version SketchUp 6.0
156
322
  def color=(color)
157
323
  end
158
324
 
159
- # The colorize_deltas method retrieves the HLS delta for colorized materials.
325
+ # The {#colorize_deltas} method retrieves the HLS delta for colorized materials.
160
326
  #
161
327
  # @example
162
- # material = Sketchup.active_model.materials[0]
328
+ # material = Sketchup.active_model.materials.add('Example')
163
329
  # h, l, s = material.colorize_deltas
164
330
  #
165
331
  # @return [Array(Float, Float, Float)] An array of floats representing the HLS delta.
@@ -168,50 +334,52 @@ class Sketchup::Material < Sketchup::Entity
168
334
  def colorize_deltas
169
335
  end
170
336
 
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:
337
+ # The {#colorize_type} method retrieves the type of colorization of the material.
338
+ #
339
+ # {Material Colorize Types}[#normal_style_summary]:
175
340
  #
176
- # - 0 = shift (Sketchup::Material::COLORIZE_SHIFT),
177
- # - 1 = tint (Sketchup::Material::COLORIZE_TINT),
341
+ # - {Sketchup::Material::COLORIZE_SHIFT}
342
+ # - {Sketchup::Material::COLORIZE_TINT}
178
343
  #
179
344
  # @example
180
- # material = Sketchup.active_model.materials[0]
345
+ # material = Sketchup.active_model.materials.add('Example')
181
346
  # type = material.colorize_type
182
347
  #
183
- # @return [Integer] the colorize type for the Material object.
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.
184
352
  #
185
353
  # @version SketchUp 2015
186
354
  def colorize_type
187
355
  end
188
356
 
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:
357
+ # The {#colorize_type=} method set the type of colorization of the material.
358
+ #
359
+ # {Material Colorize Types}[#normal_style_summary]:
193
360
  #
194
- # - 0 = shift (Sketchup::Material::COLORIZE_SHIFT),
195
- # - 1 = tint (Sketchup::Material::COLORIZE_TINT),
361
+ # - {Sketchup::Material::COLORIZE_SHIFT}
362
+ # - {Sketchup::Material::COLORIZE_TINT}
196
363
  #
197
364
  # @example
198
- # material = Sketchup.active_model.materials[0]
365
+ # material = Sketchup.active_model.materials.add('Example')
199
366
  # material.colorize_type = Sketchup::Material::COLORIZE_TINT
200
367
  #
201
- # @param [Integer] type
202
- # the new colorize type for the Material object.
368
+ # @note This value is only relevant when the {#materialType} is set to
369
+ # {Sketchup::Material::MATERIAL_COLORIZED_TEXTURED}.
203
370
  #
204
- # @return [Integer] the colorize type for the Material object.
371
+ # @param [Integer] type
372
+ # One of +Sketchup::Material::COLORIZE_*+ values.
205
373
  #
206
374
  # @version SketchUp 2015
207
375
  def colorize_type=(type)
208
376
  end
209
377
 
210
- # The display_name method retrieves the name that is displayed within SketchUp
378
+ # The {#display_name} method retrieves the name that is displayed within SketchUp
211
379
  # for the material.
212
380
  #
213
381
  # 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.
382
+ # cannot be used as a key in {Sketchup::Model#materials}.
215
383
  #
216
384
  # @example
217
385
  # model = Sketchup.active_model
@@ -223,36 +391,175 @@ class Sketchup::Material < Sketchup::Entity
223
391
  # # to the UI like SketchUp does.
224
392
  # puts material.display_name # Outputs "Joe"
225
393
  #
226
- # @return [String] the display name for the material
394
+ # @return [String]
395
+ #
396
+ # @see #name
227
397
  #
228
398
  # @version SketchUp 6.0
229
399
  def display_name
230
400
  end
231
401
 
232
- # The materialType method retrieves the type of the material. Types include:
402
+ # The {#materialType} method retrieves the type of the material.
403
+ #
404
+ # {Material Types}[#material_type_constant_summary]:
233
405
  #
234
- # - 0 = solid (Sketchup::Material::MATERIAL_SOLID),
235
- # - 1 = textured (Sketchup::Material::MATERIAL_TEXTURED),
236
- # - 2 = colorized textured (Sketchup::Material::MATERIAL_COLORIZED_TEXTURED).
406
+ # - +0+ = solid ({Sketchup::Material::MATERIAL_SOLID})
407
+ # - +1+ = textured ({Sketchup::Material::MATERIAL_TEXTURED})
408
+ # - +2+ = colorized textured ({Sketchup::Material::MATERIAL_COLORIZED_TEXTURED})
237
409
  #
238
- # The constants where added in SketchUp 2015.
410
+ # The constants were added in SketchUp 2015.
239
411
  #
240
412
  # @example
241
- # material = Sketchup.active_model.materials[0]
242
- # type = material.materialType
413
+ # material = Sketchup.active_model.materials.add('Example')
414
+ # material.materialType == Sketchup::Material::MATERIAL_SOLID
415
+ # # > true
243
416
  #
244
- # @return [Integer] the material type for the Material object. See
245
- # summary for details.
417
+ # @return [Integer] One of +Sketchup::Material::MATERIAL_*+ values.
246
418
  #
247
419
  # @version SketchUp 6.0
248
420
  def materialType
249
421
  end
250
422
 
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
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
253
560
  # the material from the model's material list.
254
561
  #
255
- # Use .display_name to display the name in the UI.
562
+ # Use {#display_name} to display the name in the UI.
256
563
  #
257
564
  # @example
258
565
  # model = Sketchup.active_model
@@ -264,7 +571,9 @@ class Sketchup::Material < Sketchup::Entity
264
571
  # # to the UI like SketchUp does.
265
572
  # puts material.display_name # Outputs "Joe"
266
573
  #
267
- # @return [String] the name of the Material object
574
+ # @return [String]
575
+ #
576
+ # @see #display_name
268
577
  #
269
578
  # @version SketchUp 6.0
270
579
  def name
@@ -272,36 +581,248 @@ class Sketchup::Material < Sketchup::Entity
272
581
 
273
582
  # The {#name=} method sets the name of the material.
274
583
  #
584
+ # @bug SketchUp 2018 would raise an error if you named material the name it
585
+ # already had.
586
+ #
275
587
  # @example Safely change name without raising errors
276
588
  # materials = Sketchup.active_model.materials
277
589
  # material = materials.add("Joe")
278
590
  # material.name = materials.unique_name('Jeff')
279
591
  #
280
- # @note Since SketchUp 2018 this method will raise an `ArgumentError` if the
592
+ # @note Since SketchUp 2018 this method will raise an +ArgumentError+ if the
281
593
  # name is not unique.
282
594
  #
283
- # @note SketchUp 2018 would raise an error if you named material the name it
284
- # already had.
285
- #
286
595
  # @param [String] str
287
596
  # the new material name
288
597
  #
289
598
  # @raise [ArgumentError] if the name is not unique to the model.
290
599
  # (Added in SU2018)
291
600
  #
292
- # @return [String] the newly set material name.
601
+ # @return [String]
293
602
  #
294
603
  # @version SketchUp 8.0 M1
295
604
  def name=(str)
296
605
  end
297
606
 
298
- # The {#owner_type} method is used to determine if the material is owned
299
- # by a {Sketchup::Materials}.
300
607
  #
301
- # Returned value is one of:
302
- # * +Sketchup::Material::OWNER_MANAGER+
303
- # * +Sketchup::Material::OWNER_IMAGE+
304
- # * +Sketchup::Material::OWNER_LAYER+
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}
305
826
  #
306
827
  # @return [Integer]
307
828
  #
@@ -309,52 +830,187 @@ class Sketchup::Material < Sketchup::Entity
309
830
  def owner_type
310
831
  end
311
832
 
312
- # The {#save_as} method is used to write a material to a SKM file.
313
833
  #
314
- # You must remember to append ".skm" to the filename as this will not be done
315
- # automatically.
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
+
316
872
  #
317
873
  # @example
318
- # filename = File.join(ENV['HOME'], 'Desktop', 'su_test.skm')
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')
319
972
  # materials = Sketchup.active_model.materials
320
973
  # material = materials.add("Hello World")
321
974
  # material.color = 'red'
322
975
  # material.save_as(filename)
323
976
  #
977
+ # @note You must remember to append ".skm" to the filename as this will not be
978
+ # done automatically.
979
+ #
324
980
  # @param [String] filename
325
981
  # the path to the SKM file to load.
326
982
  #
327
- # @return [Boolean] `true` if successful
983
+ # @return [Boolean]
328
984
  #
329
985
  # @version SketchUp 2017
330
986
  def save_as(filename)
331
987
  end
332
988
 
333
- # The texture method retrieves the texture of the material.
989
+ # The {#texture} method retrieves the texture of the material.
334
990
  #
335
991
  # @example
336
992
  # model = Sketchup.active_model
337
993
  # materials = model.materials
338
994
  # material = materials.add('Joe')
339
- # material.texture = "C:/Materials/Carpet.jpg"
995
+ # material.texture = 'path/to/metallic_texture.png'
340
996
  # texture = material.texture
341
997
  #
342
- # @return [Sketchup::Texture, nil] the Texture object within the Material.
343
- # Returns nil if the Material does not have a texture.
998
+ # @return [Sketchup::Texture, nil]
344
999
  #
345
1000
  # @version SketchUp 6.0
346
1001
  def texture
347
1002
  end
348
1003
 
349
- # The texture= method sets the texture for the material.
1004
+ # The {#texture=} method sets the texture for the material.
350
1005
  #
351
- # Setting the texture to +nil+ will turn it into a solid color
1006
+ # Setting the texture to +nil+ will turn remove it and the material will use
1007
+ # {#color}.
352
1008
  #
353
1009
  # @example
354
1010
  # model = Sketchup.active_model
355
1011
  # materials = model.materials
356
1012
  # material = materials.add('Joe')
357
- # material.texture = "C:/Materials/Carpet.jpg"
1013
+ # material.texture = 'path/to/metallic_texture.png'
358
1014
  #
359
1015
  # @overload texture=(filename)
360
1016
  #
@@ -364,51 +1020,96 @@ class Sketchup::Material < Sketchup::Entity
364
1020
  # @overload texture=(properties)
365
1021
  #
366
1022
  # @param [Array(String, Length, Length)] properties
367
- # An array with the texture file path and optionally the width and height.
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}.
368
1031
  #
369
1032
  # @overload texture=(image_rep)
370
1033
  #
1034
+ # @version SketchUp 2018
371
1035
  # @param [Sketchup::ImageRep] image_rep The pixel data representing the
372
- # texture. (Added in SketchUp 2018)
1036
+ # texture.
373
1037
  #
374
1038
  # @version SketchUp 6.0
375
1039
  def texture=(arg)
376
1040
  end
377
1041
 
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.
1042
+ # The {#use_alpha?} method tells if the material uses transparency. It uses
1043
+ # some tolerance checking to account for floating point precision noise.
382
1044
  #
383
1045
  # @example
384
- # material = Sketchup.active_model.materials[0]
385
- # is_alpha = material.use_alpha?
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+.
386
1056
  #
387
1057
  # @return [Boolean]
388
1058
  #
1059
+ # @see #alpha
1060
+ #
1061
+ # @see #alpha=
1062
+ #
389
1063
  # @version SketchUp 6.0
390
1064
  def use_alpha?
391
1065
  end
392
1066
 
393
- # The write_thumbnail method writes a bitmap thumbnail to the given file name.
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.
394
1094
  #
395
1095
  # @example
396
1096
  # model = Sketchup.active_model
397
1097
  # model.materials.each { |material|
398
- # thumbnail_file = "C:/tmp/materials/#{material.display_name}.png"
1098
+ # thumbnail_file = File.join(Sketchup.temp_dir, "#{material.display_name}.png")
399
1099
  # material.write_thumbnail(thumbnail_file, 128)
400
1100
  # }
401
1101
  #
402
1102
  # @param [String] path
403
1103
  # The file path for the thumbnail.
404
1104
  #
405
- # @param [Integer] resolution
406
- # The resolution of the thumbnail.
1105
+ # @param [Integer] max_size
1106
+ # The maximum width or height of the generated image.
407
1107
  #
408
- # @return [Boolean] true if successful, false if unsuccessful.
1108
+ # @return [Boolean, nil] +true+ if successful, +false+ if unsuccessful.
1109
+ # +nil+ if arguments are invalid.
409
1110
  #
410
1111
  # @version SketchUp 8.0 M1
411
- def write_thumbnail(path, resolution)
1112
+ def write_thumbnail(path, max_size)
412
1113
  end
413
1114
 
414
1115
  end