scriptup 2026.0.1 → 2026.0.2
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.
- checksums.yaml +4 -4
- data/README.md +43 -24
- data/ext/arc_curve.c +50 -0
- data/ext/attribute_dictionaries.c +49 -32
- data/ext/attribute_dictionary.c +54 -127
- data/ext/axes.c +79 -0
- data/ext/behavior.c +100 -9
- data/ext/bounding_box.c +195 -0
- data/ext/camera.c +178 -0
- data/ext/classifications.c +85 -0
- data/ext/color.c +91 -163
- data/ext/component_definition.c +78 -162
- data/ext/component_instance.c +88 -9
- data/ext/construction.c +59 -0
- data/ext/curve.c +87 -0
- data/ext/definition_list.c +89 -109
- data/ext/depend +1 -0
- data/ext/drawing_element.c +96 -117
- data/ext/edge.c +147 -0
- data/ext/edge_use.c +37 -0
- data/ext/entities.c +573 -16
- data/ext/entities_builder.c +145 -0
- data/ext/entity.c +175 -215
- data/ext/environments.c +149 -0
- data/ext/extconf.rb +54 -10
- data/ext/face.c +331 -0
- data/ext/geom.c +172 -0
- data/ext/group.c +86 -0
- data/ext/helpers.c +244 -0
- data/ext/image.c +182 -0
- data/ext/image_rep.c +158 -0
- data/ext/instance_path.c +185 -0
- data/ext/lat_long.c +88 -0
- data/ext/layer.c +98 -0
- data/ext/layer_folder.c +99 -0
- data/ext/layers.c +122 -0
- data/ext/length.c +253 -0
- data/ext/line_styles.c +60 -0
- data/ext/loop.c +24 -0
- data/ext/material.c +144 -197
- data/ext/materials.c +49 -60
- data/ext/model.c +232 -26
- data/ext/options_store.c +188 -0
- data/ext/page.c +168 -0
- data/ext/pages.c +135 -0
- data/ext/point2d.c +195 -0
- data/ext/point3d.c +340 -0
- data/ext/polygon_mesh.c +253 -0
- data/ext/scriptup.h +279 -0
- data/ext/section_plane.c +44 -0
- data/ext/sketchup.c +102 -76
- data/ext/styles.c +91 -0
- data/ext/text.c +135 -0
- data/ext/texture.c +74 -83
- data/ext/texture_writer.c +104 -0
- data/ext/transformation.c +309 -0
- data/ext/transformation2d.c +190 -0
- data/ext/uv_helper.c +41 -0
- data/ext/vector2d.c +238 -0
- data/ext/vector3d.c +294 -0
- data/ext/vertex.c +67 -0
- data/lib/sketchup.rb +2 -2
- data/sig/_top_level.rbs +188 -0
- data/sig/array.rbs +52 -0
- data/sig/geom/bounding_box.rbs +28 -0
- data/sig/geom/bounds2d.rbs +20 -0
- data/sig/geom/lat_long.rbs +13 -0
- data/sig/geom/oriented_bounds2d.rbs +10 -0
- data/sig/geom/point2d.rbs +32 -0
- data/sig/geom/point3d.rbs +46 -0
- data/sig/geom/polygon_mesh.rbs +35 -0
- data/sig/geom/transformation.rbs +44 -0
- data/sig/geom/transformation2d.rbs +26 -0
- data/sig/geom/utm.rbs +14 -0
- data/sig/geom/vector2d.rbs +40 -0
- data/sig/geom/vector3d.rbs +49 -0
- data/sig/geom.rbs +25 -0
- data/sig/language_handler.rbs +8 -0
- data/sig/layout/angular_dimension.rbs +32 -0
- data/sig/layout/auto_text_definition.rbs +73 -0
- data/sig/layout/auto_text_definitions.rbs +15 -0
- data/sig/layout/connection_point.rbs +6 -0
- data/sig/layout/dictionary.rbs +18 -0
- data/sig/layout/document.rbs +61 -0
- data/sig/layout/ellipse.rbs +5 -0
- data/sig/layout/entities.rbs +10 -0
- data/sig/layout/entity.rbs +28 -0
- data/sig/layout/formatted_text.rbs +30 -0
- data/sig/layout/grid.rbs +24 -0
- data/sig/layout/group.rbs +17 -0
- data/sig/layout/image.rbs +7 -0
- data/sig/layout/label.rbs +31 -0
- data/sig/layout/layer.rbs +21 -0
- data/sig/layout/layer_instance.rbs +9 -0
- data/sig/layout/layers.rbs +18 -0
- data/sig/layout/linear_dimension.rbs +39 -0
- data/sig/layout/locked_entity_error.rbs +4 -0
- data/sig/layout/locked_layer_error.rbs +4 -0
- data/sig/layout/page.rbs +20 -0
- data/sig/layout/page_info.rbs +37 -0
- data/sig/layout/pages.rbs +17 -0
- data/sig/layout/path.rbs +34 -0
- data/sig/layout/rectangle.rbs +15 -0
- data/sig/layout/reference_entity.rbs +7 -0
- data/sig/layout/sketch_up_model.rbs +54 -0
- data/sig/layout/style.rbs +150 -0
- data/sig/layout/table.rbs +17 -0
- data/sig/layout/table_cell.rbs +13 -0
- data/sig/layout/table_column.rbs +10 -0
- data/sig/layout/table_row.rbs +10 -0
- data/sig/layout.rbs +4 -0
- data/sig/length.rbs +37 -0
- data/sig/numeric.rbs +23 -0
- data/sig/sketchup/animation.rbs +8 -0
- data/sig/sketchup/app_observer.rbs +11 -0
- data/sig/sketchup/arc_curve.rbs +14 -0
- data/sig/sketchup/attribute_dictionaries.rbs +11 -0
- data/sig/sketchup/attribute_dictionary.rbs +18 -0
- data/sig/sketchup/axes.rbs +13 -0
- data/sig/sketchup/behavior.rbs +19 -0
- data/sig/sketchup/camera.rbs +33 -0
- data/sig/sketchup/classification_schema.rbs +8 -0
- data/sig/sketchup/classifications.rbs +12 -0
- data/sig/sketchup/color.rbs +22 -0
- data/sig/sketchup/component_definition.rbs +43 -0
- data/sig/sketchup/component_instance.rbs +32 -0
- data/sig/sketchup/console.rbs +8 -0
- data/sig/sketchup/construction_line.rbs +17 -0
- data/sig/sketchup/construction_point.rbs +5 -0
- data/sig/sketchup/curve.rbs +13 -0
- data/sig/sketchup/definition_list.rbs +26 -0
- data/sig/sketchup/definition_observer.rbs +6 -0
- data/sig/sketchup/definitions_observer.rbs +8 -0
- data/sig/sketchup/dimension.rbs +18 -0
- data/sig/sketchup/dimension_linear.rbs +24 -0
- data/sig/sketchup/dimension_observer.rbs +5 -0
- data/sig/sketchup/dimension_radial.rbs +9 -0
- data/sig/sketchup/drawingelement.rbs +18 -0
- data/sig/sketchup/edge.rbs +24 -0
- data/sig/sketchup/edge_use.rbs +13 -0
- data/sig/sketchup/entities.rbs +61 -0
- data/sig/sketchup/entities_builder.rbs +15 -0
- data/sig/sketchup/entities_observer.rbs +9 -0
- data/sig/sketchup/entity.rbs +21 -0
- data/sig/sketchup/entity_observer.rbs +6 -0
- data/sig/sketchup/environment.rbs +25 -0
- data/sig/sketchup/environments.rbs +18 -0
- data/sig/sketchup/environments_observer.rbs +8 -0
- data/sig/sketchup/extensions_manager.rbs +11 -0
- data/sig/sketchup/face.rbs +44 -0
- data/sig/sketchup/frame_change_observer.rbs +5 -0
- data/sig/sketchup/group.rbs +38 -0
- data/sig/sketchup/http/request.rbs +17 -0
- data/sig/sketchup/http/response.rbs +7 -0
- data/sig/sketchup/http.rbs +27 -0
- data/sig/sketchup/image.rbs +23 -0
- data/sig/sketchup/image_rep.rbs +17 -0
- data/sig/sketchup/importer.rbs +14 -0
- data/sig/sketchup/input_point.rbs +25 -0
- data/sig/sketchup/instance_observer.rbs +6 -0
- data/sig/sketchup/instance_path.rbs +20 -0
- data/sig/sketchup/layer.rbs +20 -0
- data/sig/sketchup/layer_folder.rbs +26 -0
- data/sig/sketchup/layers.rbs +30 -0
- data/sig/sketchup/layers_observer.rbs +13 -0
- data/sig/sketchup/licensing/extension_license.rbs +8 -0
- data/sig/sketchup/licensing.rbs +15 -0
- data/sig/sketchup/line_style.rbs +5 -0
- data/sig/sketchup/line_styles.rbs +13 -0
- data/sig/sketchup/load_handler.rbs +8 -0
- data/sig/sketchup/loop.rbs +10 -0
- data/sig/sketchup/material.rbs +74 -0
- data/sig/sketchup/materials.rbs +22 -0
- data/sig/sketchup/materials_observer.rbs +10 -0
- data/sig/sketchup/menu.rbs +9 -0
- data/sig/sketchup/model.rbs +105 -0
- data/sig/sketchup/model_observer.rbs +23 -0
- data/sig/sketchup/options_manager.rbs +12 -0
- data/sig/sketchup/options_provider.rbs +23 -0
- data/sig/sketchup/options_provider_observer.rbs +5 -0
- data/sig/sketchup/overlay.rbs +21 -0
- data/sig/sketchup/overlays_manager.rbs +10 -0
- data/sig/sketchup/page.rbs +55 -0
- data/sig/sketchup/pages.rbs +25 -0
- data/sig/sketchup/pages_observer.rbs +7 -0
- data/sig/sketchup/pick_helper.rbs +28 -0
- data/sig/sketchup/regional_settings.rbs +7 -0
- data/sig/sketchup/rendering_options.rbs +89 -0
- data/sig/sketchup/rendering_options_observer.rbs +5 -0
- data/sig/sketchup/section_plane.rbs +12 -0
- data/sig/sketchup/selection.rbs +31 -0
- data/sig/sketchup/selection_observer.rbs +8 -0
- data/sig/sketchup/set.rbs +15 -0
- data/sig/sketchup/shadow_info.rbs +18 -0
- data/sig/sketchup/shadow_info_observer.rbs +5 -0
- data/sig/sketchup/skp.rbs +5 -0
- data/sig/sketchup/snap.rbs +10 -0
- data/sig/sketchup/style.rbs +9 -0
- data/sig/sketchup/styles.rbs +21 -0
- data/sig/sketchup/text.rbs +22 -0
- data/sig/sketchup/texture.rbs +14 -0
- data/sig/sketchup/texture_writer.rbs +14 -0
- data/sig/sketchup/tool.rbs +45 -0
- data/sig/sketchup/tools.rbs +14 -0
- data/sig/sketchup/tools_observer.rbs +6 -0
- data/sig/sketchup/uv_helper.rbs +6 -0
- data/sig/sketchup/vertex.rbs +11 -0
- data/sig/sketchup/view.rbs +87 -0
- data/sig/sketchup/view_observer.rbs +6 -0
- data/sig/sketchup.rbs +137 -0
- data/sig/sketchup_extension.rbs +23 -0
- data/sig/string.rbs +5 -0
- data/sig/ui/command.rbs +20 -0
- data/sig/ui/html_dialog.rbs +29 -0
- data/sig/ui/notification.rbs +16 -0
- data/sig/ui/toolbar.rbs +18 -0
- data/sig/ui/web_dialog.rbs +38 -0
- data/sig/ui.rbs +66 -0
- metadata +204 -287
- data/ext/attribute_dictionaries.h +0 -8
- data/ext/attribute_dictionary.h +0 -8
- data/ext/behavior.h +0 -8
- data/ext/color.h +0 -8
- data/ext/component_definition.h +0 -8
- data/ext/component_instance.h +0 -8
- data/ext/definition_list.h +0 -8
- data/ext/drawing_element.h +0 -8
- data/ext/entities.h +0 -8
- data/ext/entity.h +0 -8
- data/ext/material.h +0 -8
- data/ext/materials.h +0 -8
- data/ext/model.h +0 -8
- data/ext/not_implemented.c +0 -88
- data/ext/not_implemented.h +0 -20
- data/ext/sketchup.h +0 -9
- data/ext/texture.h +0 -8
- data/ext/typed_value.c +0 -84
- data/ext/typed_value.h +0 -11
- data/ext/utils.h +0 -111
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeometry.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonGeoutils.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonImage.dylib +0 -4
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonPreferences.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUnits.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonUtils.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Frameworks/libCommonZip.dylib +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/application.h +0 -36
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/model.h +0 -59
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/overlay.h +0 -262
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/application/ruby_api.h +0 -118
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/color.h +0 -107
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/common.h +0 -178
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/defs.h +0 -19
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/extension_license.h +0 -70
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/bounding_box.h +0 -34
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/plane3d.h +0 -153
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point2d.h +0 -96
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/point3d.h +0 -98
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/ray3d.h +0 -64
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation.h +0 -321
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/transformation2d.h +0 -163
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector2d.h +0 -235
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry/vector3d.h +0 -285
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/geometry.h +0 -154
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelexporterplugin.h +0 -165
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/modelimporterplugin.h +0 -187
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/import_export/pluginprogresscallback.h +0 -84
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/initialize.h +0 -43
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/length_formatter.h +0 -424
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arccurve.h +0 -244
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/arrow_type.h +0 -17
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/attribute_dictionary.h +0 -161
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/axes.h +0 -242
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/camera.h +0 -398
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_attribute.h +0 -89
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classification_info.h +0 -125
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/classifications.h +0 -86
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition.h +0 -629
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_definition_snap_to_behavior_private.h +0 -46
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/component_instance.h +0 -344
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/curve.h +0 -143
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/defs.h +0 -147
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension.h +0 -224
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_linear.h +0 -421
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_radial.h +0 -194
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dimension_style.h +0 -253
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/drawing_element.h +0 -198
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_attribute.h +0 -92
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/dynamic_component_info.h +0 -70
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge.h +0 -271
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/edge_use.h +0 -214
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entities.h +0 -879
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity.h +0 -189
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list.h +0 -80
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/entity_list_iterator.h +0 -90
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environment.h +0 -382
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/environments.h +0 -133
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/face.h +0 -702
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/font.h +0 -138
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry.h +0 -20
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/geometry_input.h +0 -695
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/group.h +0 -245
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_line.h +0 -155
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/guide_point.h +0 -153
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image.h +0 -289
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/image_rep.h +0 -275
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/instancepath.h +0 -266
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer.h +0 -265
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/layer_folder.h +0 -301
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_style.h +0 -211
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/line_styles.h +0 -81
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/location.h +0 -65
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/loop.h +0 -182
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/material.h +0 -797
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/mesh_helper.h +0 -187
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model.h +0 -1826
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_entity_type_private.h +0 -44
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/model_version.h +0 -49
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/opening.h +0 -72
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_manager.h +0 -79
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/options_provider.h +0 -166
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/polyline3d.h +0 -140
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/rendering_options.h +0 -180
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/scene.h +0 -1016
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema.h +0 -56
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/schema_type.h +0 -26
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/section_plane.h +0 -212
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/selection.h +0 -156
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/shadow_info.h +0 -147
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/skp.h +0 -45
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/snap.h +0 -183
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/space.h +0 -26
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/style.h +0 -303
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/styles.h +0 -192
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/text.h +0 -392
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture.h +0 -380
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/texture_writer.h +0 -280
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/typed_value.h +0 -390
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/uv_helper.h +0 -79
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/model/vertex.h +0 -154
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup.h +0 -125
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/sketchup_info.h +0 -65
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/slapi.h +0 -16
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/transformation.h +0 -16
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/unicodestring.h +0 -239
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Headers/utils/math_helpers.h +0 -124
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/Resources/Info.plist +0 -50
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/SketchUpAPI +0 -0
- data/sketchup-sdk-mac/SketchUpAPI.framework/Versions/A/_CodeSignature/CodeResources +0 -891
- data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutAPI.lib +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutControllers.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutModel.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutRTF.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutUtils.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/LayOutView.dll +0 -4
- data/sketchup-sdk-win/binaries/layout/x64/SketchUpCommonPreferences.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.dll +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/SketchUpViewerAPI.lib +0 -0
- data/sketchup-sdk-win/binaries/layout/x64/pdflib.dll +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.dll +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpAPI.lib +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/SketchUpCommonPreferences.dll +0 -0
- data/sketchup-sdk-win/binaries/sketchup/x64/sketchup.lib +0 -0
- data/sketchup-sdk-win/headers/LayOutAPI/application/application.h +0 -117
- data/sketchup-sdk-win/headers/LayOutAPI/common.h +0 -22
- data/sketchup-sdk-win/headers/LayOutAPI/geometry/geometry.h +0 -78
- data/sketchup-sdk-win/headers/LayOutAPI/initialize.h +0 -36
- data/sketchup-sdk-win/headers/LayOutAPI/layout.h +0 -49
- data/sketchup-sdk-win/headers/LayOutAPI/model/angulardimension.h +0 -468
- data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinition.h +0 -569
- data/sketchup-sdk-win/headers/LayOutAPI/model/autotextdefinitionlist.h +0 -79
- data/sketchup-sdk-win/headers/LayOutAPI/model/connectionpoint.h +0 -107
- data/sketchup-sdk-win/headers/LayOutAPI/model/defs.h +0 -42
- data/sketchup-sdk-win/headers/LayOutAPI/model/dictionary.h +0 -120
- data/sketchup-sdk-win/headers/LayOutAPI/model/document.h +0 -937
- data/sketchup-sdk-win/headers/LayOutAPI/model/documentexportoptions.h +0 -78
- data/sketchup-sdk-win/headers/LayOutAPI/model/ellipse.h +0 -78
- data/sketchup-sdk-win/headers/LayOutAPI/model/entity.h +0 -402
- data/sketchup-sdk-win/headers/LayOutAPI/model/entityiterator.h +0 -49
- data/sketchup-sdk-win/headers/LayOutAPI/model/entitylist.h +0 -114
- data/sketchup-sdk-win/headers/LayOutAPI/model/formattedtext.h +0 -397
- data/sketchup-sdk-win/headers/LayOutAPI/model/grid.h +0 -251
- data/sketchup-sdk-win/headers/LayOutAPI/model/group.h +0 -244
- data/sketchup-sdk-win/headers/LayOutAPI/model/image.h +0 -146
- data/sketchup-sdk-win/headers/LayOutAPI/model/imagerep.h +0 -109
- data/sketchup-sdk-win/headers/LayOutAPI/model/label.h +0 -332
- data/sketchup-sdk-win/headers/LayOutAPI/model/layer.h +0 -207
- data/sketchup-sdk-win/headers/LayOutAPI/model/layerinstance.h +0 -117
- data/sketchup-sdk-win/headers/LayOutAPI/model/layerlist.h +0 -69
- data/sketchup-sdk-win/headers/LayOutAPI/model/lineardimension.h +0 -508
- data/sketchup-sdk-win/headers/LayOutAPI/model/page.h +0 -331
- data/sketchup-sdk-win/headers/LayOutAPI/model/pageinfo.h +0 -372
- data/sketchup-sdk-win/headers/LayOutAPI/model/pagelist.h +0 -81
- data/sketchup-sdk-win/headers/LayOutAPI/model/path.h +0 -464
- data/sketchup-sdk-win/headers/LayOutAPI/model/rectangle.h +0 -240
- data/sketchup-sdk-win/headers/LayOutAPI/model/referenceentity.h +0 -120
- data/sketchup-sdk-win/headers/LayOutAPI/model/sketchupmodel.h +0 -681
- data/sketchup-sdk-win/headers/LayOutAPI/model/style.h +0 -1116
- data/sketchup-sdk-win/headers/LayOutAPI/model/table.h +0 -472
- data/sketchup-sdk-win/headers/LayOutAPI/model/typed_value.h +0 -180
- data/sketchup-sdk-win/headers/SketchUpAPI/application/application.h +0 -36
- data/sketchup-sdk-win/headers/SketchUpAPI/application/model.h +0 -59
- data/sketchup-sdk-win/headers/SketchUpAPI/application/overlay.h +0 -262
- data/sketchup-sdk-win/headers/SketchUpAPI/application/ruby_api.h +0 -118
- data/sketchup-sdk-win/headers/SketchUpAPI/color.h +0 -107
- data/sketchup-sdk-win/headers/SketchUpAPI/common.h +0 -178
- data/sketchup-sdk-win/headers/SketchUpAPI/defs.h +0 -19
- data/sketchup-sdk-win/headers/SketchUpAPI/extension_license.h +0 -70
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/bounding_box.h +0 -34
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/plane3d.h +0 -153
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point2d.h +0 -96
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/point3d.h +0 -98
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/ray3d.h +0 -64
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation.h +0 -321
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/transformation2d.h +0 -163
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector2d.h +0 -235
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry/vector3d.h +0 -285
- data/sketchup-sdk-win/headers/SketchUpAPI/geometry.h +0 -154
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelexporterplugin.h +0 -165
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/modelimporterplugin.h +0 -187
- data/sketchup-sdk-win/headers/SketchUpAPI/import_export/pluginprogresscallback.h +0 -84
- data/sketchup-sdk-win/headers/SketchUpAPI/initialize.h +0 -43
- data/sketchup-sdk-win/headers/SketchUpAPI/length_formatter.h +0 -424
- data/sketchup-sdk-win/headers/SketchUpAPI/model/arccurve.h +0 -244
- data/sketchup-sdk-win/headers/SketchUpAPI/model/arrow_type.h +0 -17
- data/sketchup-sdk-win/headers/SketchUpAPI/model/attribute_dictionary.h +0 -161
- data/sketchup-sdk-win/headers/SketchUpAPI/model/axes.h +0 -242
- data/sketchup-sdk-win/headers/SketchUpAPI/model/camera.h +0 -398
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_attribute.h +0 -89
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classification_info.h +0 -125
- data/sketchup-sdk-win/headers/SketchUpAPI/model/classifications.h +0 -86
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition.h +0 -629
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_definition_snap_to_behavior_private.h +0 -46
- data/sketchup-sdk-win/headers/SketchUpAPI/model/component_instance.h +0 -344
- data/sketchup-sdk-win/headers/SketchUpAPI/model/curve.h +0 -143
- data/sketchup-sdk-win/headers/SketchUpAPI/model/defs.h +0 -147
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension.h +0 -224
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_linear.h +0 -421
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_radial.h +0 -194
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dimension_style.h +0 -253
- data/sketchup-sdk-win/headers/SketchUpAPI/model/drawing_element.h +0 -198
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_attribute.h +0 -92
- data/sketchup-sdk-win/headers/SketchUpAPI/model/dynamic_component_info.h +0 -70
- data/sketchup-sdk-win/headers/SketchUpAPI/model/edge.h +0 -271
- data/sketchup-sdk-win/headers/SketchUpAPI/model/edge_use.h +0 -214
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entities.h +0 -879
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity.h +0 -189
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list.h +0 -80
- data/sketchup-sdk-win/headers/SketchUpAPI/model/entity_list_iterator.h +0 -90
- data/sketchup-sdk-win/headers/SketchUpAPI/model/environment.h +0 -382
- data/sketchup-sdk-win/headers/SketchUpAPI/model/environments.h +0 -133
- data/sketchup-sdk-win/headers/SketchUpAPI/model/face.h +0 -702
- data/sketchup-sdk-win/headers/SketchUpAPI/model/font.h +0 -138
- data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry.h +0 -20
- data/sketchup-sdk-win/headers/SketchUpAPI/model/geometry_input.h +0 -695
- data/sketchup-sdk-win/headers/SketchUpAPI/model/group.h +0 -245
- data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_line.h +0 -155
- data/sketchup-sdk-win/headers/SketchUpAPI/model/guide_point.h +0 -153
- data/sketchup-sdk-win/headers/SketchUpAPI/model/image.h +0 -289
- data/sketchup-sdk-win/headers/SketchUpAPI/model/image_rep.h +0 -275
- data/sketchup-sdk-win/headers/SketchUpAPI/model/instancepath.h +0 -266
- data/sketchup-sdk-win/headers/SketchUpAPI/model/layer.h +0 -265
- data/sketchup-sdk-win/headers/SketchUpAPI/model/layer_folder.h +0 -301
- data/sketchup-sdk-win/headers/SketchUpAPI/model/line_style.h +0 -211
- data/sketchup-sdk-win/headers/SketchUpAPI/model/line_styles.h +0 -81
- data/sketchup-sdk-win/headers/SketchUpAPI/model/location.h +0 -65
- data/sketchup-sdk-win/headers/SketchUpAPI/model/loop.h +0 -182
- data/sketchup-sdk-win/headers/SketchUpAPI/model/material.h +0 -797
- data/sketchup-sdk-win/headers/SketchUpAPI/model/mesh_helper.h +0 -187
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model.h +0 -1826
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model_entity_type_private.h +0 -44
- data/sketchup-sdk-win/headers/SketchUpAPI/model/model_version.h +0 -49
- data/sketchup-sdk-win/headers/SketchUpAPI/model/opening.h +0 -72
- data/sketchup-sdk-win/headers/SketchUpAPI/model/options_manager.h +0 -79
- data/sketchup-sdk-win/headers/SketchUpAPI/model/options_provider.h +0 -166
- data/sketchup-sdk-win/headers/SketchUpAPI/model/polyline3d.h +0 -140
- data/sketchup-sdk-win/headers/SketchUpAPI/model/rendering_options.h +0 -180
- data/sketchup-sdk-win/headers/SketchUpAPI/model/scene.h +0 -1016
- data/sketchup-sdk-win/headers/SketchUpAPI/model/schema.h +0 -56
- data/sketchup-sdk-win/headers/SketchUpAPI/model/schema_type.h +0 -26
- data/sketchup-sdk-win/headers/SketchUpAPI/model/section_plane.h +0 -212
- data/sketchup-sdk-win/headers/SketchUpAPI/model/selection.h +0 -156
- data/sketchup-sdk-win/headers/SketchUpAPI/model/shadow_info.h +0 -147
- data/sketchup-sdk-win/headers/SketchUpAPI/model/skp.h +0 -45
- data/sketchup-sdk-win/headers/SketchUpAPI/model/snap.h +0 -183
- data/sketchup-sdk-win/headers/SketchUpAPI/model/space.h +0 -26
- data/sketchup-sdk-win/headers/SketchUpAPI/model/style.h +0 -303
- data/sketchup-sdk-win/headers/SketchUpAPI/model/styles.h +0 -192
- data/sketchup-sdk-win/headers/SketchUpAPI/model/text.h +0 -392
- data/sketchup-sdk-win/headers/SketchUpAPI/model/texture.h +0 -380
- data/sketchup-sdk-win/headers/SketchUpAPI/model/texture_writer.h +0 -280
- data/sketchup-sdk-win/headers/SketchUpAPI/model/typed_value.h +0 -390
- data/sketchup-sdk-win/headers/SketchUpAPI/model/uv_helper.h +0 -79
- data/sketchup-sdk-win/headers/SketchUpAPI/model/vertex.h +0 -154
- data/sketchup-sdk-win/headers/SketchUpAPI/sketchup.h +0 -125
- data/sketchup-sdk-win/headers/SketchUpAPI/sketchup_info.h +0 -65
- data/sketchup-sdk-win/headers/SketchUpAPI/slapi.h +0 -16
- data/sketchup-sdk-win/headers/SketchUpAPI/transformation.h +0 -16
- data/sketchup-sdk-win/headers/SketchUpAPI/unicodestring.h +0 -239
- data/sketchup-sdk-win/headers/SketchUpAPI/utils/math_helpers.h +0 -124
data/ext/color.c
CHANGED
|
@@ -1,211 +1,139 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
#include <color.h>
|
|
3
|
-
#include <SketchUpAPI/sketchup.h>
|
|
4
|
-
#include <utils.h>
|
|
1
|
+
#include <scriptup.h>
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
#define COLOR(obj) ((SUColor*)DATA_PTR(obj))
|
|
4
|
+
|
|
5
|
+
static VALUE color_alloc(VALUE klass)
|
|
7
6
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return 0;
|
|
13
|
-
else
|
|
14
|
-
return color;
|
|
7
|
+
SUColor* color;
|
|
8
|
+
VALUE obj = Data_Make_Struct(klass, SUColor, 0, RUBY_DEFAULT_FREE, color);
|
|
9
|
+
*color = (SUColor){0, 0, 0, 255};
|
|
10
|
+
return obj;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
|
-
static
|
|
13
|
+
static void color_set_rgba(SUColor* color, int argc, const VALUE* argv)
|
|
18
14
|
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return 0.0;
|
|
24
|
-
else
|
|
25
|
-
return alpha;
|
|
15
|
+
color->red = (SUByte)su_clamp_int(argv[0], 0, 255);
|
|
16
|
+
color->green = (SUByte)su_clamp_int(argv[1], 0, 255);
|
|
17
|
+
color->blue = (SUByte)su_clamp_int(argv[2], 0, 255);
|
|
18
|
+
color->alpha = argc > 3 ? (SUByte)su_clamp_int(argv[3], 0, 255) : 255;
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
VALUE su_color_new(SUColor value)
|
|
29
22
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
color->red = 0;
|
|
33
|
-
color->green = 0;
|
|
34
|
-
color->blue = 0;
|
|
35
|
-
color->alpha = 255;
|
|
23
|
+
VALUE obj = color_alloc(cColor);
|
|
24
|
+
*COLOR(obj) = value;
|
|
36
25
|
return obj;
|
|
37
26
|
}
|
|
38
27
|
|
|
39
|
-
|
|
28
|
+
VALUE su_color_coerce(VALUE obj)
|
|
29
|
+
{
|
|
30
|
+
if (rb_obj_is_kind_of(obj, cColor))
|
|
31
|
+
return obj;
|
|
32
|
+
if (!RB_TYPE_P(obj, T_ARRAY))
|
|
33
|
+
rb_raise(rb_eTypeError, "no implicit conversion to Color");
|
|
34
|
+
if (RARRAY_LEN(obj) < 3)
|
|
35
|
+
rb_raise(rb_eArgError, "At least 3 values required");
|
|
36
|
+
VALUE color = color_alloc(cColor);
|
|
37
|
+
color_set_rgba(COLOR(color), (int)RARRAY_LEN(obj), RARRAY_CONST_PTR(obj));
|
|
38
|
+
return color;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static VALUE color_names(VALUE self)
|
|
40
42
|
{
|
|
41
43
|
size_t count = 0;
|
|
42
44
|
SUColorGetNumNames(&count);
|
|
43
|
-
SUStringRef* names =
|
|
45
|
+
SUStringRef* names = ZALLOC_N(SUStringRef, count);
|
|
44
46
|
for (size_t i = 0; i < count; i++)
|
|
45
47
|
{
|
|
46
|
-
names[i].ptr =
|
|
48
|
+
names[i].ptr = NULL;
|
|
47
49
|
SUStringCreate(&names[i]);
|
|
48
50
|
}
|
|
49
51
|
SUColorGetNames(names, count);
|
|
50
|
-
VALUE ary =
|
|
51
|
-
for (size_t i = 0; i < count; i++)
|
|
52
|
-
{
|
|
53
|
-
VALUE name;
|
|
54
|
-
GETUTF8FROMSTRING(names[i], name);
|
|
55
|
-
rb_ary_push(ary, name);
|
|
56
|
-
}
|
|
52
|
+
VALUE ary = rb_ary_new_capa((long)count);
|
|
57
53
|
for (size_t i = 0; i < count; i++)
|
|
58
54
|
{
|
|
55
|
+
rb_ary_push(ary, su_string_to_rb(names[i]));
|
|
59
56
|
SUStringRelease(&names[i]);
|
|
60
57
|
}
|
|
61
|
-
|
|
58
|
+
xfree(names);
|
|
62
59
|
return ary;
|
|
63
60
|
}
|
|
64
61
|
|
|
65
|
-
static VALUE
|
|
62
|
+
static VALUE color_initialize(int argc, VALUE* argv, VALUE self)
|
|
66
63
|
{
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
{
|
|
76
|
-
SUColorSetByValue(color, NUM2INT(argv[0]));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else if (argc == 3)
|
|
80
|
-
{
|
|
81
|
-
color->red = GETCOLOR(argv[0]);
|
|
82
|
-
color->green = GETCOLOR(argv[1]);
|
|
83
|
-
color->blue = GETCOLOR(argv[2]);
|
|
84
|
-
color->alpha = 255;
|
|
85
|
-
}
|
|
86
|
-
else if (argc == 4)
|
|
87
|
-
{
|
|
88
|
-
color->red = GETCOLOR(argv[0]);
|
|
89
|
-
color->green = GETCOLOR(argv[1]);
|
|
90
|
-
color->blue = GETCOLOR(argv[2]);
|
|
91
|
-
color->alpha = GETALPHA(argv[3]);
|
|
92
|
-
}
|
|
64
|
+
rb_check_arity(argc, 0, 4);
|
|
65
|
+
SUColor* color = COLOR(self);
|
|
66
|
+
if (argc == 1 && RB_TYPE_P(argv[0], T_STRING))
|
|
67
|
+
SUColorSetByName(color, StringValueCStr(argv[0]));
|
|
68
|
+
else if (argc == 1 && RB_INTEGER_TYPE_P(argv[0]))
|
|
69
|
+
SUColorSetByValue(color, NUM2UINT(argv[0]));
|
|
70
|
+
else if (argc >= 3)
|
|
71
|
+
color_set_rgba(color, argc, argv);
|
|
93
72
|
return self;
|
|
94
73
|
}
|
|
95
74
|
|
|
96
|
-
static VALUE
|
|
97
|
-
{
|
|
98
|
-
SUColor* color = DATA_PTR(self);
|
|
99
|
-
SUColor* otherColor = DATA_PTR(other);
|
|
100
|
-
return (color->red == otherColor->red && color->green == otherColor->green && color->blue == otherColor->blue && color->alpha == otherColor->alpha)
|
|
101
|
-
? Qtrue
|
|
102
|
-
: Qfalse;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static VALUE Sketchup_Color_Get_alpha(VALUE self)
|
|
106
|
-
{
|
|
107
|
-
SUColor* color = DATA_PTR(self);
|
|
108
|
-
return INT2NUM(color->alpha);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
static VALUE Sketchup_Color_Set_alpha(VALUE self, VALUE alpha)
|
|
112
|
-
{
|
|
113
|
-
SUColor* color = DATA_PTR(self);
|
|
114
|
-
color->alpha = NUM2INT(alpha);
|
|
115
|
-
return alpha;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static VALUE Sketchup_Color_blend(VALUE self, VALUE other, VALUE weight)
|
|
119
|
-
{
|
|
120
|
-
SUColor* color = DATA_PTR(self);
|
|
121
|
-
SUColor* otherColor = DATA_PTR(other);
|
|
122
|
-
VALUE output = rb_obj_alloc(rb_path2class(SKETCHUP_COLOR));
|
|
123
|
-
SUColor* outputColor = DATA_PTR(output);
|
|
124
|
-
SUColorBlend(*color, *otherColor, NUM2DBL(weight), outputColor);
|
|
125
|
-
return output;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
static VALUE Sketchup_Color_Get_blue(VALUE self)
|
|
129
|
-
{
|
|
130
|
-
SUColor* color = DATA_PTR(self);
|
|
131
|
-
return INT2NUM(color->blue);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
static VALUE Sketchup_Color_Set_blue(VALUE self, VALUE blue)
|
|
75
|
+
static VALUE color_eq(VALUE self, VALUE other)
|
|
135
76
|
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
77
|
+
if (!rb_obj_is_kind_of(other, cColor))
|
|
78
|
+
return Qfalse;
|
|
79
|
+
SUColor* a = COLOR(self);
|
|
80
|
+
SUColor* b = COLOR(other);
|
|
81
|
+
return BOOL2RB(a->red == b->red && a->green == b->green && a->blue == b->blue && a->alpha == b->alpha);
|
|
139
82
|
}
|
|
140
83
|
|
|
141
|
-
static VALUE
|
|
84
|
+
static VALUE color_blend(VALUE self, VALUE other, VALUE weight)
|
|
142
85
|
{
|
|
143
|
-
SUColor
|
|
144
|
-
|
|
86
|
+
SUColor output;
|
|
87
|
+
SUColorBlend(*COLOR(self), *COLOR(su_color_coerce(other)), NUM2DBL(weight), &output);
|
|
88
|
+
return su_color_new(output);
|
|
145
89
|
}
|
|
146
90
|
|
|
147
|
-
|
|
148
|
-
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
91
|
+
#define DEFINE_CHANNEL(channel) \
|
|
92
|
+
static VALUE color_##channel(VALUE self) { return INT2FIX(COLOR(self)->channel); } \
|
|
93
|
+
static VALUE color_set_##channel(VALUE self, VALUE value) \
|
|
94
|
+
{ \
|
|
95
|
+
COLOR(self)->channel = (SUByte)su_clamp_int(value, 0, 255); \
|
|
96
|
+
return value; \
|
|
97
|
+
}
|
|
98
|
+
DEFINE_CHANNEL(red)
|
|
99
|
+
DEFINE_CHANNEL(green)
|
|
100
|
+
DEFINE_CHANNEL(blue)
|
|
101
|
+
DEFINE_CHANNEL(alpha)
|
|
159
102
|
|
|
160
|
-
static VALUE
|
|
103
|
+
static VALUE color_to_a(VALUE self)
|
|
161
104
|
{
|
|
162
|
-
SUColor*
|
|
163
|
-
|
|
164
|
-
return red;
|
|
105
|
+
SUColor* c = COLOR(self);
|
|
106
|
+
return rb_ary_new_from_args(4, INT2FIX(c->red), INT2FIX(c->green), INT2FIX(c->blue), INT2FIX(c->alpha));
|
|
165
107
|
}
|
|
166
108
|
|
|
167
|
-
static VALUE
|
|
109
|
+
static VALUE color_to_i(VALUE self)
|
|
168
110
|
{
|
|
169
|
-
SUColor*
|
|
170
|
-
|
|
171
|
-
rb_ary_push(ary, INT2NUM(color->red));
|
|
172
|
-
rb_ary_push(ary, INT2NUM(color->green));
|
|
173
|
-
rb_ary_push(ary, INT2NUM(color->blue));
|
|
174
|
-
rb_ary_push(ary, INT2NUM(color->alpha));
|
|
175
|
-
return ary;
|
|
111
|
+
SUColor* c = COLOR(self);
|
|
112
|
+
return INT2NUM(c->red | c->green << 8 | c->blue << 16);
|
|
176
113
|
}
|
|
177
114
|
|
|
178
|
-
static VALUE
|
|
115
|
+
static VALUE color_to_s(VALUE self)
|
|
179
116
|
{
|
|
180
|
-
SUColor*
|
|
181
|
-
return
|
|
117
|
+
SUColor* c = COLOR(self);
|
|
118
|
+
return rb_sprintf("Color(%d, %d, %d, %d)", c->red, c->green, c->blue, c->alpha);
|
|
182
119
|
}
|
|
183
120
|
|
|
184
|
-
|
|
121
|
+
void Init_color(void)
|
|
185
122
|
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
123
|
+
rb_define_alloc_func(cColor, color_alloc);
|
|
124
|
+
rb_define_singleton_method(cColor, "names", color_names, 0);
|
|
125
|
+
rb_define_method(cColor, "initialize", color_initialize, -1);
|
|
126
|
+
rb_define_method(cColor, "==", color_eq, 1);
|
|
127
|
+
rb_define_method(cColor, "blend", color_blend, 2);
|
|
128
|
+
rb_define_method(cColor, "red", color_red, 0);
|
|
129
|
+
rb_define_method(cColor, "red=", color_set_red, 1);
|
|
130
|
+
rb_define_method(cColor, "green", color_green, 0);
|
|
131
|
+
rb_define_method(cColor, "green=", color_set_green, 1);
|
|
132
|
+
rb_define_method(cColor, "blue", color_blue, 0);
|
|
133
|
+
rb_define_method(cColor, "blue=", color_set_blue, 1);
|
|
134
|
+
rb_define_method(cColor, "alpha", color_alpha, 0);
|
|
135
|
+
rb_define_method(cColor, "alpha=", color_set_alpha, 1);
|
|
136
|
+
rb_define_method(cColor, "to_a", color_to_a, 0);
|
|
137
|
+
rb_define_method(cColor, "to_i", color_to_i, 0);
|
|
138
|
+
rb_define_method(cColor, "to_s", color_to_s, 0);
|
|
190
139
|
}
|
|
191
|
-
|
|
192
|
-
void Color_Init(VALUE Sketchup, VALUE Sketchup_Object)
|
|
193
|
-
{
|
|
194
|
-
VALUE Sketchup_Color = rb_define_class_under(Sketchup, COLOR, Sketchup_Object);
|
|
195
|
-
rb_define_alloc_func(Sketchup_Color, alloc);
|
|
196
|
-
rb_define_singleton_method(Sketchup_Color, "names", Sketchup_Color_names, 0);
|
|
197
|
-
rb_define_method(Sketchup_Color, "initialize", Sketchup_Color_initialize, -1);
|
|
198
|
-
rb_define_method(Sketchup_Color, "==", Sketchup_Color_equ, 1);
|
|
199
|
-
rb_define_method(Sketchup_Color, "alpha", Sketchup_Color_Get_alpha, 0);
|
|
200
|
-
rb_define_method(Sketchup_Color, "alpha=", Sketchup_Color_Set_alpha, 1);
|
|
201
|
-
rb_define_method(Sketchup_Color, "blend", Sketchup_Color_blend, 2);
|
|
202
|
-
rb_define_method(Sketchup_Color, "blue", Sketchup_Color_Get_blue, 0);
|
|
203
|
-
rb_define_method(Sketchup_Color, "blue=", Sketchup_Color_Set_blue, 1);
|
|
204
|
-
rb_define_method(Sketchup_Color, "green", Sketchup_Color_Get_green, 0);
|
|
205
|
-
rb_define_method(Sketchup_Color, "green=", Sketchup_Color_Set_green, 1);
|
|
206
|
-
rb_define_method(Sketchup_Color, "red", Sketchup_Color_Get_red, 0);
|
|
207
|
-
rb_define_method(Sketchup_Color, "red=", Sketchup_Color_Set_red, 1);
|
|
208
|
-
rb_define_method(Sketchup_Color, "to_a", Sketchup_Color_to_a, 0);
|
|
209
|
-
rb_define_method(Sketchup_Color, "to_i", Sketchup_Color_to_i, 0);
|
|
210
|
-
rb_define_method(Sketchup_Color, "to_s", Sketchup_Color_to_s, 0);
|
|
211
|
-
}
|
data/ext/component_definition.c
CHANGED
|
@@ -1,189 +1,105 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
#include <component_definition.h>
|
|
3
|
-
#include <utils.h>
|
|
4
|
-
#include <SketchUpAPI/sketchup.h>
|
|
1
|
+
#include <scriptup.h>
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
DEFINE_STRING_GETTER(componentdefinition_name, SUComponentDefinitionRef, SUComponentDefinitionGetName)
|
|
4
|
+
DEFINE_STRING_SETTER(componentdefinition_set_name, SUComponentDefinitionRef, SUComponentDefinitionSetName)
|
|
5
|
+
DEFINE_STRING_GETTER(componentdefinition_description, SUComponentDefinitionRef, SUComponentDefinitionGetDescription)
|
|
6
|
+
DEFINE_STRING_SETTER(componentdefinition_set_description, SUComponentDefinitionRef, SUComponentDefinitionSetDescription)
|
|
7
|
+
DEFINE_STRING_GETTER(componentdefinition_path, SUComponentDefinitionRef, SUComponentDefinitionGetPath)
|
|
8
|
+
DEFINE_STRING_GETTER(componentdefinition_guid, SUComponentDefinitionRef, SUComponentDefinitionGetGuid)
|
|
9
|
+
DEFINE_SIZE_GETTER(componentdefinition_count_instances, SUComponentDefinitionRef, SUComponentDefinitionGetNumInstances)
|
|
10
|
+
DEFINE_SIZE_GETTER(componentdefinition_count_used_instances, SUComponentDefinitionRef, SUComponentDefinitionGetNumUsedInstances)
|
|
11
|
+
DEFINE_BOOL_GETTER(componentdefinition_live_component_p, SUComponentDefinitionRef, SUComponentDefinitionIsLiveComponent)
|
|
12
|
+
DEFINE_BOOL_GETTER(componentdefinition_internal_p, SUComponentDefinitionRef, SUComponentDefinitionIsInternal)
|
|
13
|
+
DEFINE_REF_GETTER(componentdefinition_entities, SUComponentDefinitionRef, SUComponentDefinitionGetEntities, SUEntitiesRef, cEntities)
|
|
14
|
+
DEFINE_REF_LIST(componentdefinition_instance_list, SUComponentDefinitionRef, SUComponentDefinitionGetNumInstances,
|
|
15
|
+
SUComponentDefinitionGetInstances, SUComponentInstanceRef, cComponentInstance)
|
|
13
16
|
|
|
14
|
-
static VALUE
|
|
17
|
+
static VALUE componentdefinition_instances(VALUE self)
|
|
15
18
|
{
|
|
16
|
-
SUComponentDefinitionRef
|
|
17
|
-
SUComponentDefinitionSetName(definition, StringValuePtr(name));
|
|
18
|
-
return name;
|
|
19
|
+
return componentdefinition_instance_list(SU_REF(SUComponentDefinitionRef, self));
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
static VALUE
|
|
22
|
+
static VALUE componentdefinition_cmp(VALUE self, VALUE other)
|
|
22
23
|
{
|
|
23
|
-
if (!rb_obj_is_kind_of(other,
|
|
24
|
+
if (!rb_obj_is_kind_of(other, cComponentDefinition))
|
|
24
25
|
return Qnil;
|
|
25
|
-
|
|
26
|
-
#pragma clang diagnostic ignored "-Wcompound-token-split-by-macro"
|
|
27
|
-
return rb_funcall(Sketchup_ComponentDefinition_Get_name(self), rb_intern("<=>"), 1, Sketchup_ComponentDefinition_Get_name(other));
|
|
28
|
-
#pragma clang diagnostic pop
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static VALUE Sketchup_ComponentDefinition_Object_equ(VALUE self, VALUE other)
|
|
32
|
-
{
|
|
33
|
-
if (!rb_obj_is_kind_of(other, rb_path2class(SKETCHUP_COMPONENTDEFINITION)))
|
|
34
|
-
return Qfalse;
|
|
35
|
-
SUComponentDefinitionRef definition1 = {DATA_PTR(self)};
|
|
36
|
-
SUComponentDefinitionRef definition2 = {DATA_PTR(other)};
|
|
37
|
-
return definition1.ptr == definition2.ptr;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
void Sketchup_ComponentDefinition_instances_Iterator(SUComponentInstanceRef componentInstance, VALUE ary)
|
|
41
|
-
{
|
|
42
|
-
rb_ary_push(ary, Data_Wrap_Struct(rb_path2class(SKETCHUP_COMPONENTINSTANCE), 0, 0, componentInstance.ptr));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static VALUE Sketchup_ComponentDefinition_instances(VALUE self)
|
|
46
|
-
{
|
|
47
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
48
|
-
VALUE ary = rb_ary_new();
|
|
49
|
-
FOREACH(
|
|
50
|
-
SUComponentDefinitionGetNumInstances,
|
|
51
|
-
SUComponentDefinitionGetInstances,
|
|
52
|
-
SUComponentInstanceRef,
|
|
53
|
-
definition,
|
|
54
|
-
Sketchup_ComponentDefinition_instances_Iterator,
|
|
55
|
-
ary);
|
|
56
|
-
return ary;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static VALUE Sketchup_ComponentDefinition_count_instances(VALUE self)
|
|
60
|
-
{
|
|
61
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
62
|
-
size_t count = 0;
|
|
63
|
-
SUComponentDefinitionGetNumInstances(definition, &count);
|
|
64
|
-
return ULL2NUM(count);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static VALUE Sketchup_ComponentDefinition_count_used_instances(VALUE self)
|
|
68
|
-
{
|
|
69
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
70
|
-
size_t count = 0;
|
|
71
|
-
SUComponentDefinitionGetNumUsedInstances(definition, &count);
|
|
72
|
-
return ULL2NUM(count);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
static VALUE Sketchup_ComponentDefinition_live_component(VALUE self)
|
|
76
|
-
{
|
|
77
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
78
|
-
bool output = false;
|
|
79
|
-
SUComponentDefinitionIsLiveComponent(definition, &output);
|
|
80
|
-
return output ? Qtrue : Qfalse;
|
|
26
|
+
return INT2FIX(rb_str_cmp(componentdefinition_name(self), componentdefinition_name(other)));
|
|
81
27
|
}
|
|
82
28
|
|
|
83
|
-
static VALUE
|
|
29
|
+
static VALUE componentdefinition_eq(VALUE self, VALUE other)
|
|
84
30
|
{
|
|
85
|
-
|
|
86
|
-
bool is_internal = false;
|
|
87
|
-
SUComponentDefinitionIsInternal(definition, &is_internal);
|
|
88
|
-
return is_internal ? Qtrue : Qfalse;
|
|
31
|
+
return BOOL2RB(rb_obj_is_kind_of(other, cComponentDefinition) && DATA_PTR(self) == DATA_PTR(other));
|
|
89
32
|
}
|
|
90
33
|
|
|
91
|
-
static VALUE
|
|
34
|
+
static VALUE componentdefinition_group_p(VALUE self)
|
|
92
35
|
{
|
|
93
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
94
|
-
SUEntitiesRef entities;
|
|
95
|
-
SUComponentDefinitionGetEntities(definition, &entities);
|
|
96
|
-
return Data_Wrap_Struct(rb_path2class(SKETCHUP_ENTITIES), 0, 0, entities.ptr);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
static VALUE Sketchup_ComponentDefinition_path(VALUE self)
|
|
100
|
-
{
|
|
101
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
102
|
-
VALUE output;
|
|
103
|
-
GETSTRING(SUComponentDefinitionGetPath, definition, output);
|
|
104
|
-
return output;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
static VALUE Sketchup_ComponentDefinition_guid(VALUE self)
|
|
108
|
-
{
|
|
109
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
110
|
-
VALUE output;
|
|
111
|
-
GETSTRING(SUComponentDefinitionGetGuid, definition, output);
|
|
112
|
-
return output;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
static VALUE Sketchup_ComponentDefinition_group(VALUE self)
|
|
116
|
-
{
|
|
117
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
118
36
|
enum SUComponentType type = SUComponentType_Normal;
|
|
119
|
-
SUComponentDefinitionGetType(
|
|
120
|
-
return type == SUComponentType_Group
|
|
37
|
+
SUComponentDefinitionGetType(SU_REF(SUComponentDefinitionRef, self), &type);
|
|
38
|
+
return BOOL2RB(type == SUComponentType_Group);
|
|
121
39
|
}
|
|
122
40
|
|
|
123
|
-
static VALUE
|
|
41
|
+
static VALUE componentdefinition_image_p(VALUE self)
|
|
124
42
|
{
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
GETSTRING(SUComponentDefinitionGetDescription, definition, output);
|
|
128
|
-
return output;
|
|
43
|
+
SUDrawingElementRef element = SUComponentDefinitionToDrawingElement(SU_REF(SUComponentDefinitionRef, self));
|
|
44
|
+
return BOOL2RB(SUIsValid(SUImageFromDrawingElement(element)));
|
|
129
45
|
}
|
|
130
46
|
|
|
131
|
-
static VALUE
|
|
47
|
+
static VALUE componentdefinition_behavior(VALUE self)
|
|
132
48
|
{
|
|
133
|
-
|
|
134
|
-
SUComponentDefinitionSetDescription(definition, StringValuePtr(description));
|
|
135
|
-
return description;
|
|
49
|
+
return su_wrap(cBehavior, DATA_PTR(self));
|
|
136
50
|
}
|
|
137
51
|
|
|
138
|
-
static VALUE
|
|
139
|
-
{
|
|
140
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
141
|
-
SUImageRef image = SUImageFromDrawingElement(SUComponentDefinitionToDrawingElement(definition));
|
|
142
|
-
return SUIsValid(image) ? Qtrue : Qfalse;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
static VALUE Sketchup_ComponentDefinition_behavior(VALUE self)
|
|
146
|
-
{
|
|
147
|
-
SUComponentDefinitionRef definition = {DATA_PTR(self)};
|
|
148
|
-
struct SUComponentBehavior behavior;
|
|
149
|
-
SUComponentDefinitionGetBehavior(definition, &behavior);
|
|
150
|
-
return Data_Wrap_Struct(rb_path2class(SKETCHUP_BEHAVIOR), 0, 0, &behavior);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
static VALUE Sketchup_ComponentDefinition_save_as(int argc, VALUE* argv, VALUE self)
|
|
52
|
+
static VALUE componentdefinition_save_as(int argc, VALUE* argv, VALUE self)
|
|
154
53
|
{
|
|
155
54
|
VALUE path;
|
|
156
55
|
VALUE version;
|
|
157
56
|
rb_scan_args(argc, argv, "11", &path, &version);
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
57
|
+
enum SUModelVersion model_version = NIL_P(version) ? SUModelVersion_Current : (enum SUModelVersion)NUM2INT(version);
|
|
58
|
+
enum SUResult result = SUComponentDefinitionSaveToFile(SU_REF(SUComponentDefinitionRef, self), StringValueCStr(path), model_version);
|
|
59
|
+
return result == SU_ERROR_NONE ? Qtrue : Qnil;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Always the origin since SketchUp 2020; there is no working setter in the C API.
|
|
63
|
+
static VALUE componentdefinition_insertion_point(VALUE self)
|
|
64
|
+
{
|
|
65
|
+
struct SUPoint3D point = {0, 0, 0};
|
|
66
|
+
SUComponentDefinitionGetInsertPoint(SU_REF(SUComponentDefinitionRef, self), &point);
|
|
67
|
+
return su_point3d_new(point);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The time the definition was loaded from file; the epoch if it wasn't.
|
|
71
|
+
static VALUE componentdefinition_load_time(VALUE self)
|
|
72
|
+
{
|
|
73
|
+
struct tm time;
|
|
74
|
+
memset(&time, 0, sizeof(time));
|
|
75
|
+
if (SUComponentDefinitionGetLoadTime(SU_REF(SUComponentDefinitionRef, self), &time) != SU_ERROR_NONE)
|
|
76
|
+
return rb_time_new(0, 0);
|
|
77
|
+
return rb_funcall(rb_cTime, (rb_intern)("local"), 6, INT2FIX(time.tm_year + 1900), INT2FIX(time.tm_mon + 1),
|
|
78
|
+
INT2FIX(time.tm_mday), INT2FIX(time.tm_hour), INT2FIX(time.tm_min), INT2FIX(time.tm_sec));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void Init_component_definition(void)
|
|
82
|
+
{
|
|
83
|
+
rb_include_module(cComponentDefinition, rb_mComparable);
|
|
84
|
+
rb_define_method(cComponentDefinition, "name", componentdefinition_name, 0);
|
|
85
|
+
rb_define_method(cComponentDefinition, "name=", componentdefinition_set_name, 1);
|
|
86
|
+
rb_define_method(cComponentDefinition, "==", componentdefinition_eq, 1);
|
|
87
|
+
rb_define_method(cComponentDefinition, "<=>", componentdefinition_cmp, 1);
|
|
88
|
+
rb_define_method(cComponentDefinition, "instances", componentdefinition_instances, 0);
|
|
89
|
+
rb_define_method(cComponentDefinition, "count_instances", componentdefinition_count_instances, 0);
|
|
90
|
+
rb_define_method(cComponentDefinition, "count_used_instances", componentdefinition_count_used_instances, 0);
|
|
91
|
+
rb_define_method(cComponentDefinition, "live_component?", componentdefinition_live_component_p, 0);
|
|
92
|
+
rb_define_method(cComponentDefinition, "internal?", componentdefinition_internal_p, 0);
|
|
93
|
+
rb_define_method(cComponentDefinition, "entities", componentdefinition_entities, 0);
|
|
94
|
+
rb_define_method(cComponentDefinition, "path", componentdefinition_path, 0);
|
|
95
|
+
rb_define_method(cComponentDefinition, "guid", componentdefinition_guid, 0);
|
|
96
|
+
rb_define_method(cComponentDefinition, "group?", componentdefinition_group_p, 0);
|
|
97
|
+
rb_define_method(cComponentDefinition, "description", componentdefinition_description, 0);
|
|
98
|
+
rb_define_method(cComponentDefinition, "description=", componentdefinition_set_description, 1);
|
|
99
|
+
rb_define_method(cComponentDefinition, "image?", componentdefinition_image_p, 0);
|
|
100
|
+
rb_define_method(cComponentDefinition, "behavior", componentdefinition_behavior, 0);
|
|
101
|
+
rb_define_method(cComponentDefinition, "save_as", componentdefinition_save_as, -1);
|
|
102
|
+
rb_define_method(cComponentDefinition, "save_copy", componentdefinition_save_as, -1);
|
|
103
|
+
rb_define_method(cComponentDefinition, "insertion_point", componentdefinition_insertion_point, 0);
|
|
104
|
+
rb_define_method(cComponentDefinition, "load_time", componentdefinition_load_time, 0);
|
|
164
105
|
}
|
|
165
|
-
|
|
166
|
-
VALUE ComponentDefinition_Init(VALUE Sketchup, VALUE Sketchup_DrawingElement)
|
|
167
|
-
{
|
|
168
|
-
VALUE Sketchup_ComponentDefinition = rb_define_class_under(Sketchup, COMPONENTDEFINITION, Sketchup_DrawingElement);
|
|
169
|
-
rb_undef_alloc_func(Sketchup_ComponentDefinition);
|
|
170
|
-
rb_define_method(Sketchup_ComponentDefinition, "name", Sketchup_ComponentDefinition_Get_name, 0);
|
|
171
|
-
rb_define_method(Sketchup_ComponentDefinition, "name=", Sketchup_ComponentDefinition_Set_name, 1);
|
|
172
|
-
rb_define_method(Sketchup_ComponentDefinition, "==", Sketchup_ComponentDefinition_Object_equ, 1);
|
|
173
|
-
rb_define_method(Sketchup_ComponentDefinition, "<=>", Sketchup_ComponentDefinition_Name_equ, 1);
|
|
174
|
-
rb_define_method(Sketchup_ComponentDefinition, "instances", Sketchup_ComponentDefinition_instances, 0);
|
|
175
|
-
rb_define_method(Sketchup_ComponentDefinition, "count_instances", Sketchup_ComponentDefinition_count_instances, 0);
|
|
176
|
-
rb_define_method(Sketchup_ComponentDefinition, "count_used_instances", Sketchup_ComponentDefinition_count_used_instances, 0);
|
|
177
|
-
rb_define_method(Sketchup_ComponentDefinition, "live_component?", Sketchup_ComponentDefinition_live_component, 0);
|
|
178
|
-
rb_define_method(Sketchup_ComponentDefinition, "internal?", Sketchup_ComponentDefinition_internal, 0);
|
|
179
|
-
rb_define_method(Sketchup_ComponentDefinition, "entities", Sketchup_ComponentDefinition_entities, 0);
|
|
180
|
-
rb_define_method(Sketchup_ComponentDefinition, "path", Sketchup_ComponentDefinition_path, 0);
|
|
181
|
-
rb_define_method(Sketchup_ComponentDefinition, "guid", Sketchup_ComponentDefinition_guid, 0);
|
|
182
|
-
rb_define_method(Sketchup_ComponentDefinition, "group?", Sketchup_ComponentDefinition_group, 0);
|
|
183
|
-
rb_define_method(Sketchup_ComponentDefinition, "description", Sketchup_ComponentDefinition_Get_description, 0);
|
|
184
|
-
rb_define_method(Sketchup_ComponentDefinition, "description=", Sketchup_ComponentDefinition_Set_description, 1);
|
|
185
|
-
rb_define_method(Sketchup_ComponentDefinition, "image?", Sketchup_ComponentDefinition_image, 0);
|
|
186
|
-
rb_define_method(Sketchup_ComponentDefinition, "behavior", Sketchup_ComponentDefinition_behavior, 0);
|
|
187
|
-
rb_define_method(Sketchup_ComponentDefinition, "save_as", Sketchup_ComponentDefinition_save_as, -1);
|
|
188
|
-
return Sketchup_ComponentDefinition;
|
|
189
|
-
}
|
data/ext/component_instance.c
CHANGED
|
@@ -1,11 +1,90 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
#include <component_instance.h>
|
|
3
|
-
#include <utils.h>
|
|
4
|
-
#include <SketchUpAPI/sketchup.h>
|
|
1
|
+
#include <scriptup.h>
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
#define INSTANCE(self) SU_REF(SUComponentInstanceRef, self)
|
|
4
|
+
|
|
5
|
+
// Shared with Sketchup::Group, which is a component instance in the C API.
|
|
6
|
+
DEFINE_BOOL_GETTER(su_instance_locked_p_impl, SUComponentInstanceRef, SUComponentInstanceIsLocked)
|
|
7
|
+
DEFINE_BOOL_SETTER(su_instance_set_locked_impl, SUComponentInstanceRef, SUComponentInstanceSetLocked)
|
|
8
|
+
|
|
9
|
+
VALUE su_instance_locked_p(VALUE self) { return su_instance_locked_p_impl(self); }
|
|
10
|
+
VALUE su_instance_set_locked(VALUE self, VALUE lock) { return su_instance_set_locked_impl(self, lock); }
|
|
11
|
+
|
|
12
|
+
VALUE su_instance_volume(VALUE self)
|
|
13
|
+
{
|
|
14
|
+
double volume = 0.0;
|
|
15
|
+
if (SUComponentInstanceComputeVolume(INSTANCE(self), NULL, &volume) != SU_ERROR_NONE)
|
|
16
|
+
return DBL2NUM(-1.0);
|
|
17
|
+
return DBL2NUM(volume);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
VALUE su_instance_manifold_p(VALUE self)
|
|
21
|
+
{
|
|
22
|
+
double volume = 0.0;
|
|
23
|
+
return BOOL2RB(SUComponentInstanceComputeVolume(INSTANCE(self), NULL, &volume) == SU_ERROR_NONE);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
VALUE su_instance_glued_to(VALUE self)
|
|
27
|
+
{
|
|
28
|
+
size_t count = 0;
|
|
29
|
+
SUComponentInstanceGetNumAttachedToDrawingElements(INSTANCE(self), &count);
|
|
30
|
+
if (count == 0)
|
|
31
|
+
return Qnil;
|
|
32
|
+
SUDrawingElementRef* elements = ZALLOC_N(SUDrawingElementRef, count);
|
|
33
|
+
SUComponentInstanceGetAttachedToDrawingElements(INSTANCE(self), count, elements, &count);
|
|
34
|
+
VALUE glued = su_wrap_entity((SUEntityRef){elements[0].ptr});
|
|
35
|
+
xfree(elements);
|
|
36
|
+
return glued;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
DEFINE_STRING_GETTER(componentinstance_name, SUComponentInstanceRef, SUComponentInstanceGetName)
|
|
40
|
+
DEFINE_STRING_SETTER(componentinstance_set_name, SUComponentInstanceRef, SUComponentInstanceSetName)
|
|
41
|
+
DEFINE_STRING_GETTER(componentinstance_guid, SUComponentInstanceRef, SUComponentInstanceGetGuid)
|
|
42
|
+
DEFINE_REF_GETTER(componentinstance_definition, SUComponentInstanceRef, SUComponentInstanceGetDefinition, SUComponentDefinitionRef, cComponentDefinition)
|
|
43
|
+
|
|
44
|
+
static VALUE componentinstance_transformation(VALUE self)
|
|
45
|
+
{
|
|
46
|
+
struct SUTransformation t;
|
|
47
|
+
SUComponentInstanceGetTransform(INSTANCE(self), &t);
|
|
48
|
+
return su_transformation_new(t);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
static VALUE componentinstance_set_transformation(VALUE self, VALUE transformation)
|
|
52
|
+
{
|
|
53
|
+
struct SUTransformation t = su_to_transformation(transformation);
|
|
54
|
+
SUComponentInstanceSetTransform(INSTANCE(self), &t);
|
|
55
|
+
return transformation;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static VALUE componentinstance_move_bang(VALUE self, VALUE transformation)
|
|
59
|
+
{
|
|
60
|
+
componentinstance_set_transformation(self, transformation);
|
|
61
|
+
return Qtrue;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static VALUE componentinstance_transform_bang(VALUE self, VALUE transformation)
|
|
65
|
+
{
|
|
66
|
+
struct SUTransformation by = su_to_transformation(transformation);
|
|
67
|
+
struct SUTransformation current;
|
|
68
|
+
struct SUTransformation result;
|
|
69
|
+
SUComponentInstanceGetTransform(INSTANCE(self), ¤t);
|
|
70
|
+
SUTransformationMultiply(&by, ¤t, &result);
|
|
71
|
+
SUComponentInstanceSetTransform(INSTANCE(self), &result);
|
|
72
|
+
return Qtrue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
void Init_component_instance(void)
|
|
7
76
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
77
|
+
rb_define_method(cComponentInstance, "name", componentinstance_name, 0);
|
|
78
|
+
rb_define_method(cComponentInstance, "name=", componentinstance_set_name, 1);
|
|
79
|
+
rb_define_method(cComponentInstance, "guid", componentinstance_guid, 0);
|
|
80
|
+
rb_define_method(cComponentInstance, "definition", componentinstance_definition, 0);
|
|
81
|
+
rb_define_method(cComponentInstance, "transformation", componentinstance_transformation, 0);
|
|
82
|
+
rb_define_method(cComponentInstance, "transformation=", componentinstance_set_transformation, 1);
|
|
83
|
+
rb_define_method(cComponentInstance, "move!", componentinstance_move_bang, 1);
|
|
84
|
+
rb_define_method(cComponentInstance, "transform!", componentinstance_transform_bang, 1);
|
|
85
|
+
rb_define_method(cComponentInstance, "locked?", su_instance_locked_p, 0);
|
|
86
|
+
rb_define_method(cComponentInstance, "locked=", su_instance_set_locked, 1);
|
|
87
|
+
rb_define_method(cComponentInstance, "volume", su_instance_volume, 0);
|
|
88
|
+
rb_define_method(cComponentInstance, "manifold?", su_instance_manifold_p, 0);
|
|
89
|
+
rb_define_method(cComponentInstance, "glued_to", su_instance_glued_to, 0);
|
|
90
|
+
}
|