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
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 83c478bcb9a00e4f39b1b4fe6004881ab04a145438d3b95da7538912f5883f23
|
|
4
|
+
data.tar.gz: a6287a516bd263a641eb1de031e014d599bededf86e266e4ff85da95ba06026f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9faddef71f0b5027c99447c42debf357f7e3fb58b05111def0167400a5a1a47275d3787dc2e3bae158b9f5183429f66068e9f6c1d17b7cd2349c887f3bc6e983
|
|
7
|
+
data.tar.gz: 9c4df6519a0820fbfdd4ead40f148e33ea555ca9b5e0db6f7d0a2bb80cc1dcd354829f98435fc6c93348a12db175f0c443121fd00457ea9ec8f6b01d56034db9
|
data/README.md
CHANGED
|
@@ -1,24 +1,43 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
# scriptup
|
|
2
|
+
|
|
3
|
+
Ruby bindings for the SketchUp C API that mimic the SketchUp [Ruby API](https://ruby.sketchup.com), so extension tests can run outside SketchUp. macOS and Windows.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
The SketchUp C API SDK isn't bundled. Download the SDK zip for your platform from https://extensions.sketchup.com/sketchup-sdk and point the build at it:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
SKETCHUP_SDK_PATH=/path/to/sdk.zip gem install scriptup
|
|
11
|
+
# or
|
|
12
|
+
SKETCHUP_SDK_URL=https://host/sdk.zip SKETCHUP_SDK_TOKEN=... gem install scriptup # token is optional, sent as a bearer token
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The zip is extracted to `sketchup-sdk/` on the first build; delete it to switch SDKs.
|
|
16
|
+
|
|
17
|
+
## Status (SketchUp 2026.0 API)
|
|
18
|
+
|
|
19
|
+
Everything the standalone C API can support is implemented and tested: the Geom classes, Length, entities and geometry, components and groups, tags, materials and textures, images, annotations, scenes, styles, cameras, rendering/shadow options, classifications and environments.
|
|
20
|
+
|
|
21
|
+
Methods that have no C API counterpart are left undefined. Each test file lists them in `UNSUPPORTED`. Run `bundle exec rake rbs:coverage` for per-class counts and missing methods.
|
|
22
|
+
|
|
23
|
+
## Gaps
|
|
24
|
+
|
|
25
|
+
- **No C API:** observers, UI/View/Tools, operations (undo), export/import, boolean ops, pushpull/followme, explode, and app-level `Sketchup` module functions.
|
|
26
|
+
- **Only inside SketchUp:** Selection, Licensing, Sketchup version/edition.
|
|
27
|
+
- **Blocked on fixtures:** Dimension, DimensionLinear, DimensionRadial and Snap need a test model that contains them; the C API can't create them in a model.
|
|
28
|
+
- **Partial:** geometry added through the API isn't merged as in SketchUp; construction lines are read-only.
|
|
29
|
+
|
|
30
|
+
## Direction
|
|
31
|
+
|
|
32
|
+
The bindings follow RBS generated from the Ruby API docs (`scripts/rbs/`, shipped in `sig/`). Next, generate much of the C binding code from that RBS using the `DEFINE_*` macros in `ext/scriptup.h`.
|
|
33
|
+
|
|
34
|
+
## Development
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
bundle exec rake # compile, test (needs SKETCHUP_SDK_PATH or SKETCHUP_SDK_URL)
|
|
38
|
+
bundle exec rake rbs # generate and validate RBS
|
|
39
|
+
bundle exec rake rbs:coverage # implemented vs. Ruby API, per class
|
|
40
|
+
bundle exec rake check_symbols # C API calls the SDK library doesn't export
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
CI pulls the SDK from this repo's private GitHub container registry packages.
|
data/ext/arc_curve.c
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#include <scriptup.h>
|
|
2
|
+
|
|
3
|
+
#define ARC(self) SU_REF(SUArcCurveRef, self)
|
|
4
|
+
|
|
5
|
+
DEFINE_DOUBLE_GETTER(arccurve_radius, SUArcCurveRef, SUArcCurveGetRadius)
|
|
6
|
+
DEFINE_DOUBLE_GETTER(arccurve_start_angle, SUArcCurveRef, SUArcCurveGetStartAngle)
|
|
7
|
+
DEFINE_DOUBLE_GETTER(arccurve_end_angle, SUArcCurveRef, SUArcCurveGetEndAngle)
|
|
8
|
+
DEFINE_BOOL_GETTER(arccurve_circular_p, SUArcCurveRef, SUArcCurveGetIsFullCircle)
|
|
9
|
+
|
|
10
|
+
static VALUE arccurve_center(VALUE self)
|
|
11
|
+
{
|
|
12
|
+
struct SUPoint3D center = {0, 0, 0};
|
|
13
|
+
SUArcCurveGetCenter(ARC(self), ¢er);
|
|
14
|
+
return su_point3d_new(center);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#define DEFINE_VECTOR(fn, SUFn) \
|
|
18
|
+
static VALUE fn(VALUE self) \
|
|
19
|
+
{ \
|
|
20
|
+
struct SUVector3D v = {0, 0, 0}; \
|
|
21
|
+
SUFn(ARC(self), &v); \
|
|
22
|
+
return su_vector3d_new(v); \
|
|
23
|
+
}
|
|
24
|
+
DEFINE_VECTOR(arccurve_normal, SUArcCurveGetNormal)
|
|
25
|
+
DEFINE_VECTOR(arccurve_xaxis, SUArcCurveGetXAxis)
|
|
26
|
+
DEFINE_VECTOR(arccurve_yaxis, SUArcCurveGetYAxis)
|
|
27
|
+
|
|
28
|
+
static VALUE arccurve_plane(VALUE self)
|
|
29
|
+
{
|
|
30
|
+
struct SUPoint3D center = {0, 0, 0};
|
|
31
|
+
struct SUVector3D normal = {0, 0, 0};
|
|
32
|
+
SUArcCurveGetCenter(ARC(self), ¢er);
|
|
33
|
+
SUArcCurveGetNormal(ARC(self), &normal);
|
|
34
|
+
struct SUPlane3D plane;
|
|
35
|
+
SUPlane3DSetWithPointAndNormal(&plane, ¢er, &normal);
|
|
36
|
+
return rb_ary_new_from_args(4, DBL2NUM(plane.a), DBL2NUM(plane.b), DBL2NUM(plane.c), DBL2NUM(plane.d));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void Init_arc_curve(void)
|
|
40
|
+
{
|
|
41
|
+
rb_define_method(cArcCurve, "center", arccurve_center, 0);
|
|
42
|
+
rb_define_method(cArcCurve, "radius", arccurve_radius, 0);
|
|
43
|
+
rb_define_method(cArcCurve, "start_angle", arccurve_start_angle, 0);
|
|
44
|
+
rb_define_method(cArcCurve, "end_angle", arccurve_end_angle, 0);
|
|
45
|
+
rb_define_method(cArcCurve, "circular?", arccurve_circular_p, 0);
|
|
46
|
+
rb_define_method(cArcCurve, "normal", arccurve_normal, 0);
|
|
47
|
+
rb_define_method(cArcCurve, "xaxis", arccurve_xaxis, 0);
|
|
48
|
+
rb_define_method(cArcCurve, "yaxis", arccurve_yaxis, 0);
|
|
49
|
+
rb_define_method(cArcCurve, "plane", arccurve_plane, 0);
|
|
50
|
+
}
|
|
@@ -1,46 +1,63 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
#include <attribute_dictionaries.h>
|
|
3
|
-
#include <utils.h>
|
|
4
|
-
#include <SketchUpAPI/sketchup.h>
|
|
1
|
+
#include <scriptup.h>
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
// Wraps either a model or an entity; models are flagged with a hidden ivar.
|
|
4
|
+
#define OWNER_IS_MODEL "__owner_is_model"
|
|
5
|
+
|
|
6
|
+
DEFINE_REF_LIST(model_dictionaries, SUModelRef, SUModelGetNumAttributeDictionaries,
|
|
7
|
+
SUModelGetAttributeDictionaries, SUAttributeDictionaryRef, cAttributeDictionary)
|
|
8
|
+
DEFINE_REF_LIST(entity_dictionaries, SUEntityRef, SUEntityGetNumAttributeDictionaries,
|
|
9
|
+
SUEntityGetAttributeDictionaries, SUAttributeDictionaryRef, cAttributeDictionary)
|
|
10
|
+
|
|
11
|
+
VALUE su_model_attribute_dictionaries(SUModelRef model)
|
|
7
12
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (result != SU_ERROR_NONE)
|
|
12
|
-
return Qnil;
|
|
13
|
-
return Data_Wrap_Struct(rb_path2class(SKETCHUP_ATTRIBUTEDICTIONARY), 0, 0, dictionary.ptr);
|
|
13
|
+
VALUE obj = su_wrap(cAttributeDictionaries, model.ptr);
|
|
14
|
+
rb_ivar_set(obj, (rb_intern)(OWNER_IS_MODEL), Qtrue);
|
|
15
|
+
return obj;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
static VALUE attributedictionaries_to_a(VALUE self)
|
|
17
19
|
{
|
|
18
|
-
|
|
20
|
+
if (RTEST(rb_attr_get(self, (rb_intern)(OWNER_IS_MODEL))))
|
|
21
|
+
return model_dictionaries(SU_REF(SUModelRef, self));
|
|
22
|
+
return entity_dictionaries(SU_REF(SUEntityRef, self));
|
|
19
23
|
}
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
// Accepts a dictionary name or a dictionary.
|
|
26
|
+
static VALUE attributedictionaries_aref(VALUE self, VALUE key)
|
|
22
27
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
VALUE dictionaries = attributedictionaries_to_a(self);
|
|
29
|
+
if (rb_obj_is_kind_of(key, cAttributeDictionary))
|
|
30
|
+
return RTEST(rb_ary_includes(dictionaries, key)) ? key : Qnil;
|
|
31
|
+
return su_find_by(dictionaries, "name", StringValue(key));
|
|
26
32
|
}
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
// Releasing a dictionary removes it from its owner.
|
|
35
|
+
static VALUE attributedictionaries_delete(VALUE self, VALUE key)
|
|
29
36
|
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
VALUE dictionary = attributedictionaries_aref(self, key);
|
|
38
|
+
if (NIL_P(dictionary))
|
|
39
|
+
return Qnil;
|
|
40
|
+
SUAttributeDictionaryRef ref = SU_REF(SUAttributeDictionaryRef, dictionary);
|
|
41
|
+
SUAttributeDictionaryRelease(&ref);
|
|
42
|
+
return dictionary;
|
|
34
43
|
}
|
|
35
44
|
|
|
36
|
-
VALUE
|
|
45
|
+
static VALUE attributedictionaries_each(VALUE self)
|
|
37
46
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
return su_yield_each(self, attributedictionaries_to_a(self));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static VALUE attributedictionaries_length(VALUE self)
|
|
51
|
+
{
|
|
52
|
+
return LONG2NUM(RARRAY_LEN(attributedictionaries_to_a(self)));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void Init_attribute_dictionaries(void)
|
|
56
|
+
{
|
|
57
|
+
rb_include_module(cAttributeDictionaries, rb_mEnumerable);
|
|
58
|
+
rb_define_method(cAttributeDictionaries, "[]", attributedictionaries_aref, 1);
|
|
59
|
+
rb_define_method(cAttributeDictionaries, "delete", attributedictionaries_delete, 1);
|
|
60
|
+
rb_define_method(cAttributeDictionaries, "each", attributedictionaries_each, 0);
|
|
61
|
+
rb_define_method(cAttributeDictionaries, "length", attributedictionaries_length, 0);
|
|
62
|
+
rb_define_method(cAttributeDictionaries, "size", attributedictionaries_length, 0);
|
|
63
|
+
}
|
data/ext/attribute_dictionary.c
CHANGED
|
@@ -1,158 +1,85 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
#include <attribute_dictionary.h>
|
|
3
|
-
#include <typed_value.h>
|
|
4
|
-
#include <utils.h>
|
|
5
|
-
#include <SketchUpAPI/sketchup.h>
|
|
1
|
+
#include <scriptup.h>
|
|
6
2
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
SUTypedValueCreate(&typedValue);
|
|
12
|
-
enum SUResult result = SUAttributeDictionaryGetValue(dictionary, StringValuePtr(key), &typedValue);
|
|
13
|
-
if (result != SU_ERROR_NONE)
|
|
14
|
-
{
|
|
15
|
-
SUTypedValueRelease(&typedValue);
|
|
16
|
-
return Qnil;
|
|
17
|
-
}
|
|
18
|
-
VALUE output = TypedValue_get_value_type(&typedValue);
|
|
19
|
-
SUTypedValueRelease(&typedValue);
|
|
20
|
-
return output;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static VALUE Sketchup_AttributeDictionary_set(VALUE self, VALUE key, VALUE value)
|
|
24
|
-
{
|
|
25
|
-
SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
|
|
26
|
-
SUTypedValueRef typedValue = SU_INVALID;
|
|
27
|
-
SUTypedValueCreate(&typedValue);
|
|
28
|
-
TypedValue_set_value_type(&typedValue, value);
|
|
29
|
-
enum SUResult result = SUAttributeDictionarySetValue(dictionary, StringValuePtr(key), typedValue);
|
|
30
|
-
SUTypedValueRelease(&typedValue);
|
|
31
|
-
if (result != SU_ERROR_NONE)
|
|
32
|
-
return Qnil;
|
|
33
|
-
return TypedValue_get_value_type(&typedValue);
|
|
34
|
-
}
|
|
3
|
+
DEFINE_STRING_GETTER(attributedictionary_name, SUAttributeDictionaryRef, SUAttributeDictionaryGetName)
|
|
4
|
+
DEFINE_SIZE_GETTER(attributedictionary_length, SUAttributeDictionaryRef, SUAttributeDictionaryGetNumKeys)
|
|
5
|
+
DEFINE_STRING_LIST(attributedictionary_key_list, SUAttributeDictionaryRef, SUAttributeDictionaryGetNumKeys,
|
|
6
|
+
SUAttributeDictionaryGetKeys)
|
|
35
7
|
|
|
36
|
-
|
|
8
|
+
static VALUE attributedictionary_value(SUAttributeDictionaryRef dictionary, VALUE key)
|
|
37
9
|
{
|
|
38
|
-
VALUE key;
|
|
39
|
-
GETUTF8FROMSTRING(dictionary_key, key);
|
|
40
10
|
SUTypedValueRef value = SU_INVALID;
|
|
41
11
|
SUTypedValueCreate(&value);
|
|
42
|
-
|
|
43
|
-
|
|
12
|
+
VALUE output = Qnil;
|
|
13
|
+
if (SUAttributeDictionaryGetValue(dictionary, StringValueCStr(key), &value) == SU_ERROR_NONE)
|
|
14
|
+
output = su_ruby_from_typed_value(value);
|
|
44
15
|
SUTypedValueRelease(&value);
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
static VALUE Sketchup_AttributeDictionary_each(VALUE self)
|
|
49
|
-
{
|
|
50
|
-
|
|
51
|
-
SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
|
|
52
|
-
FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_Iterator, dictionary);
|
|
53
|
-
return self;
|
|
16
|
+
return output;
|
|
54
17
|
}
|
|
55
18
|
|
|
56
|
-
|
|
19
|
+
static VALUE attributedictionary_keys(VALUE self)
|
|
57
20
|
{
|
|
58
|
-
|
|
59
|
-
GETUTF8FROMSTRING(dictionary_key, key);
|
|
60
|
-
rb_yield(key);
|
|
21
|
+
return attributedictionary_key_list(SU_REF(SUAttributeDictionaryRef, self));
|
|
61
22
|
}
|
|
62
23
|
|
|
63
|
-
static VALUE
|
|
24
|
+
static VALUE attributedictionary_values(VALUE self)
|
|
64
25
|
{
|
|
65
|
-
SUAttributeDictionaryRef dictionary =
|
|
66
|
-
|
|
67
|
-
|
|
26
|
+
SUAttributeDictionaryRef dictionary = SU_REF(SUAttributeDictionaryRef, self);
|
|
27
|
+
VALUE keys = attributedictionary_key_list(dictionary);
|
|
28
|
+
VALUE values = rb_ary_new_capa(RARRAY_LEN(keys));
|
|
29
|
+
for (long i = 0; i < RARRAY_LEN(keys); i++)
|
|
30
|
+
rb_ary_push(values, attributedictionary_value(dictionary, RARRAY_AREF(keys, i)));
|
|
31
|
+
return values;
|
|
68
32
|
}
|
|
69
33
|
|
|
70
|
-
static VALUE
|
|
34
|
+
static VALUE attributedictionary_aref(VALUE self, VALUE key)
|
|
71
35
|
{
|
|
72
|
-
|
|
73
|
-
SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
|
|
74
|
-
GETSTRING(SUAttributeDictionaryGetName, dictionary, output)
|
|
75
|
-
return output;
|
|
36
|
+
return attributedictionary_value(SU_REF(SUAttributeDictionaryRef, self), key);
|
|
76
37
|
}
|
|
77
38
|
|
|
78
|
-
static VALUE
|
|
39
|
+
static VALUE attributedictionary_aset(VALUE self, VALUE key, VALUE value)
|
|
79
40
|
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
41
|
+
SUTypedValueRef typed_value = SU_INVALID;
|
|
42
|
+
SUTypedValueCreate(&typed_value);
|
|
43
|
+
su_typed_value_from_ruby(typed_value, value);
|
|
44
|
+
enum SUResult result = SUAttributeDictionarySetValue(SU_REF(SUAttributeDictionaryRef, self), StringValueCStr(key), typed_value);
|
|
45
|
+
SUTypedValueRelease(&typed_value);
|
|
46
|
+
return result == SU_ERROR_NONE ? value : Qnil;
|
|
84
47
|
}
|
|
85
48
|
|
|
86
|
-
|
|
49
|
+
static VALUE attributedictionary_each(VALUE self)
|
|
87
50
|
{
|
|
88
|
-
VALUE
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
static VALUE Sketchup_AttributeDictionary_keys(VALUE self)
|
|
94
|
-
{
|
|
95
|
-
SUAttributeDictionaryRef dictionary = {DATA_PTR(self)};
|
|
96
|
-
VALUE ary = rb_ary_new();
|
|
97
|
-
FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_keys_Iterator, ary);
|
|
98
|
-
return ary;
|
|
51
|
+
VALUE keys = attributedictionary_keys(self);
|
|
52
|
+
VALUE values = attributedictionary_values(self);
|
|
53
|
+
for (long i = 0; i < RARRAY_LEN(keys); i++)
|
|
54
|
+
rb_yield_values(2, RARRAY_AREF(keys, i), RARRAY_AREF(values, i));
|
|
55
|
+
return self;
|
|
99
56
|
}
|
|
100
57
|
|
|
101
|
-
|
|
58
|
+
static VALUE attributedictionary_each_key(VALUE self)
|
|
102
59
|
{
|
|
103
|
-
|
|
104
|
-
SUAttributeDictionaryRef dictionary;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
void Sketchup_AttributeDictionary_values_Iterator(SUStringRef dictionary_key, struct AttributeDictionary_Struct attributeDictionary_struct)
|
|
108
|
-
{
|
|
109
|
-
VALUE key;
|
|
110
|
-
GETUTF8FROMSTRING(dictionary_key, key);
|
|
111
|
-
SUTypedValueRef value = SU_INVALID;
|
|
112
|
-
SUTypedValueCreate(&value);
|
|
113
|
-
SUAttributeDictionaryGetValue(attributeDictionary_struct.dictionary, StringValuePtr(key), &value);
|
|
114
|
-
VALUE output = TypedValue_get_value_type(&value);
|
|
115
|
-
SUTypedValueRelease(&value);
|
|
116
|
-
rb_ary_push(attributeDictionary_struct.ary, output);
|
|
60
|
+
return su_yield_each(self, attributedictionary_keys(self));
|
|
117
61
|
}
|
|
118
62
|
|
|
119
|
-
static VALUE
|
|
63
|
+
static VALUE attributedictionary_empty_p(VALUE self)
|
|
120
64
|
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
FOREACHSTRING(SUAttributeDictionaryGetNumKeys, SUAttributeDictionaryGetKeys, SUStringRef, dictionary, Sketchup_AttributeDictionary_values_Iterator, values_struct);
|
|
125
|
-
return ary;
|
|
65
|
+
size_t count = 0;
|
|
66
|
+
SUAttributeDictionaryGetNumKeys(SU_REF(SUAttributeDictionaryRef, self), &count);
|
|
67
|
+
return BOOL2RB(count == 0);
|
|
126
68
|
}
|
|
127
69
|
|
|
128
|
-
|
|
70
|
+
void Init_attribute_dictionary(void)
|
|
129
71
|
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
72
|
+
rb_include_module(cAttributeDictionary, rb_mEnumerable);
|
|
73
|
+
rb_define_method(cAttributeDictionary, "[]", attributedictionary_aref, 1);
|
|
74
|
+
rb_define_method(cAttributeDictionary, "[]=", attributedictionary_aset, 2);
|
|
75
|
+
rb_define_method(cAttributeDictionary, "each", attributedictionary_each, 0);
|
|
76
|
+
rb_define_method(cAttributeDictionary, "each_pair", attributedictionary_each, 0);
|
|
77
|
+
rb_define_method(cAttributeDictionary, "each_key", attributedictionary_each_key, 0);
|
|
78
|
+
rb_define_method(cAttributeDictionary, "name", attributedictionary_name, 0);
|
|
79
|
+
rb_define_method(cAttributeDictionary, "length", attributedictionary_length, 0);
|
|
80
|
+
rb_define_method(cAttributeDictionary, "size", attributedictionary_length, 0);
|
|
81
|
+
rb_define_method(cAttributeDictionary, "keys", attributedictionary_keys, 0);
|
|
82
|
+
rb_define_method(cAttributeDictionary, "values", attributedictionary_values, 0);
|
|
83
|
+
rb_define_method(cAttributeDictionary, "empty?", attributedictionary_empty_p, 0);
|
|
84
|
+
rb_define_alias(cAttributeDictionary, "count", "size");
|
|
138
85
|
}
|
|
139
|
-
|
|
140
|
-
VALUE AttributeDictionary_Init(VALUE Sketchup, VALUE Sketchup_Entity)
|
|
141
|
-
{
|
|
142
|
-
VALUE Sketchup_AttributeDictionary = rb_define_class_under(Sketchup, ATTRIBUTEDICTIONARY, Sketchup_Entity);
|
|
143
|
-
rb_undef_alloc_func(Sketchup_AttributeDictionary);
|
|
144
|
-
rb_include_module(Sketchup_AttributeDictionary, rb_mEnumerable);
|
|
145
|
-
rb_define_method(Sketchup_AttributeDictionary, "[]", Sketchup_AttributeDictionary_get, 1);
|
|
146
|
-
rb_define_method(Sketchup_AttributeDictionary, "[]=", Sketchup_AttributeDictionary_set, 2);
|
|
147
|
-
rb_define_method(Sketchup_AttributeDictionary, "each", Sketchup_AttributeDictionary_each, 0);
|
|
148
|
-
rb_define_method(Sketchup_AttributeDictionary, "each_pair", Sketchup_AttributeDictionary_each, 0);
|
|
149
|
-
rb_define_method(Sketchup_AttributeDictionary, "each_key", Sketchup_AttributeDictionary_each_key, 0);
|
|
150
|
-
rb_define_method(Sketchup_AttributeDictionary, "name", Sketchup_AttributeDictionary_name, 0);
|
|
151
|
-
rb_define_method(Sketchup_AttributeDictionary, "length", Sketchup_AttributeDictionary_length, 0);
|
|
152
|
-
rb_define_method(Sketchup_AttributeDictionary, "size", Sketchup_AttributeDictionary_length, 0);
|
|
153
|
-
rb_define_method(Sketchup_AttributeDictionary, "keys", Sketchup_AttributeDictionary_keys, 0);
|
|
154
|
-
rb_define_method(Sketchup_AttributeDictionary, "values", Sketchup_AttributeDictionary_values, 0);
|
|
155
|
-
rb_define_method(Sketchup_AttributeDictionary, "delete_key", Sketchup_AttributeDictionary_delete_key, 1);
|
|
156
|
-
rb_define_alias(Sketchup_AttributeDictionary, "count", "size");
|
|
157
|
-
return Sketchup_AttributeDictionary;
|
|
158
|
-
}
|
data/ext/axes.c
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#include <scriptup.h>
|
|
2
|
+
|
|
3
|
+
#define AXES(self) SU_REF(SUAxesRef, self)
|
|
4
|
+
|
|
5
|
+
static VALUE axes_origin(VALUE self)
|
|
6
|
+
{
|
|
7
|
+
struct SUPoint3D origin = {0, 0, 0};
|
|
8
|
+
SUAxesGetOrigin(AXES(self), &origin);
|
|
9
|
+
return su_point3d_new(origin);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#define DEFINE_AXIS(axis, SUFn) \
|
|
13
|
+
static VALUE axes_##axis(VALUE self) \
|
|
14
|
+
{ \
|
|
15
|
+
struct SUVector3D v = {0, 0, 0}; \
|
|
16
|
+
SUFn(AXES(self), &v); \
|
|
17
|
+
return su_vector3d_new(v); \
|
|
18
|
+
}
|
|
19
|
+
DEFINE_AXIS(xaxis, SUAxesGetXAxis)
|
|
20
|
+
DEFINE_AXIS(yaxis, SUAxesGetYAxis)
|
|
21
|
+
DEFINE_AXIS(zaxis, SUAxesGetZAxis)
|
|
22
|
+
|
|
23
|
+
static VALUE axes_axes(VALUE self)
|
|
24
|
+
{
|
|
25
|
+
return rb_ary_new_from_args(3, axes_xaxis(self), axes_yaxis(self), axes_zaxis(self));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static VALUE axes_to_a(VALUE self)
|
|
29
|
+
{
|
|
30
|
+
return rb_ary_new_from_args(4, axes_origin(self), axes_xaxis(self), axes_yaxis(self), axes_zaxis(self));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static VALUE axes_transformation(VALUE self)
|
|
34
|
+
{
|
|
35
|
+
struct SUTransformation t;
|
|
36
|
+
SUAxesGetTransform(AXES(self), &t);
|
|
37
|
+
return su_transformation_new(t);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static VALUE axes_sketch_plane(VALUE self)
|
|
41
|
+
{
|
|
42
|
+
struct SUPlane3D plane = {0, 0, 1, 0};
|
|
43
|
+
SUAxesGetPlane(AXES(self), &plane);
|
|
44
|
+
return rb_ary_new_from_args(4, DBL2NUM(plane.a), DBL2NUM(plane.b), DBL2NUM(plane.c), DBL2NUM(plane.d));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static VALUE axes_set(VALUE self, VALUE origin, VALUE xaxis, VALUE yaxis, VALUE zaxis)
|
|
48
|
+
{
|
|
49
|
+
struct SUPoint3D o = su_to_point3d(origin);
|
|
50
|
+
struct SUVector3D x = su_to_vector3d(xaxis);
|
|
51
|
+
struct SUVector3D y = su_to_vector3d(yaxis);
|
|
52
|
+
struct SUVector3D z = su_to_vector3d(zaxis);
|
|
53
|
+
if (SUAxesSetAxesVecs(AXES(self), &x, &y, &z) != SU_ERROR_NONE)
|
|
54
|
+
rb_raise(rb_eArgError, "axes must be orthogonal");
|
|
55
|
+
SUAxesSetOrigin(AXES(self), &o);
|
|
56
|
+
return self;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Model#axes
|
|
60
|
+
static VALUE model_axes(VALUE model)
|
|
61
|
+
{
|
|
62
|
+
SUAxesRef axes = SU_INVALID;
|
|
63
|
+
SUModelGetAxes(SU_REF(SUModelRef, model), &axes);
|
|
64
|
+
return su_wrap_or_nil(cAxes, axes.ptr);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void Init_axes(void)
|
|
68
|
+
{
|
|
69
|
+
rb_define_method(cAxes, "origin", axes_origin, 0);
|
|
70
|
+
rb_define_method(cAxes, "xaxis", axes_xaxis, 0);
|
|
71
|
+
rb_define_method(cAxes, "yaxis", axes_yaxis, 0);
|
|
72
|
+
rb_define_method(cAxes, "zaxis", axes_zaxis, 0);
|
|
73
|
+
rb_define_method(cAxes, "axes", axes_axes, 0);
|
|
74
|
+
rb_define_method(cAxes, "to_a", axes_to_a, 0);
|
|
75
|
+
rb_define_method(cAxes, "transformation", axes_transformation, 0);
|
|
76
|
+
rb_define_method(cAxes, "sketch_plane", axes_sketch_plane, 0);
|
|
77
|
+
rb_define_method(cAxes, "set", axes_set, 4);
|
|
78
|
+
rb_define_method(cModel, "axes", model_axes, 0);
|
|
79
|
+
}
|
data/ext/behavior.c
CHANGED
|
@@ -1,11 +1,102 @@
|
|
|
1
|
-
#include <
|
|
2
|
-
#include <behavior.h>
|
|
3
|
-
#include <utils.h>
|
|
4
|
-
#include <SketchUpAPI/sketchup.h>
|
|
1
|
+
#include <scriptup.h>
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
// A Behavior wraps its component definition (or model, flagged with a hidden ivar); changes are written back.
|
|
4
|
+
static bool owner_is_model(VALUE self)
|
|
7
5
|
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
return RTEST(rb_attr_get(self, (rb_intern)("__owner_is_model")));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
static struct SUComponentBehavior behavior_get(VALUE self)
|
|
10
|
+
{
|
|
11
|
+
struct SUComponentBehavior behavior;
|
|
12
|
+
memset(&behavior, 0, sizeof(behavior));
|
|
13
|
+
if (owner_is_model(self))
|
|
14
|
+
SUModelGetBehavior(SU_REF(SUModelRef, self), &behavior);
|
|
15
|
+
else
|
|
16
|
+
SUComponentDefinitionGetBehavior(SU_REF(SUComponentDefinitionRef, self), &behavior);
|
|
17
|
+
return behavior;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static void behavior_set(VALUE self, struct SUComponentBehavior behavior)
|
|
21
|
+
{
|
|
22
|
+
if (owner_is_model(self))
|
|
23
|
+
SUModelSetBehavior(SU_REF(SUModelRef, self), &behavior);
|
|
24
|
+
else
|
|
25
|
+
SUComponentDefinitionSetBehavior(SU_REF(SUComponentDefinitionRef, self), &behavior);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#define DEFINE_FLAG(name, field) \
|
|
29
|
+
static VALUE behavior_##name##_p(VALUE self) { return BOOL2RB(behavior_get(self).field); } \
|
|
30
|
+
static VALUE behavior_set_##name(VALUE self, VALUE value) \
|
|
31
|
+
{ \
|
|
32
|
+
struct SUComponentBehavior b = behavior_get(self); \
|
|
33
|
+
b.field = RTEST(value); \
|
|
34
|
+
behavior_set(self, b); \
|
|
35
|
+
return value; \
|
|
36
|
+
}
|
|
37
|
+
DEFINE_FLAG(always_face_camera, component_always_face_camera)
|
|
38
|
+
DEFINE_FLAG(cuts_opening, component_cuts_opening)
|
|
39
|
+
DEFINE_FLAG(shadows_face_sun, component_shadows_face_sun)
|
|
40
|
+
|
|
41
|
+
static VALUE behavior_no_scale_mask_p(VALUE self)
|
|
42
|
+
{
|
|
43
|
+
return SIZET2NUM(behavior_get(self).component_no_scale_mask);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static VALUE behavior_set_no_scale_mask(VALUE self, VALUE mask)
|
|
47
|
+
{
|
|
48
|
+
struct SUComponentBehavior b = behavior_get(self);
|
|
49
|
+
b.component_no_scale_mask = NUM2SIZET(mask) & 0x7F;
|
|
50
|
+
behavior_set(self, b);
|
|
51
|
+
return mask;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Ruby SnapTo_Arbitrary/Horizontal/Vertical/Sloped are 0..3; the C enum adds None in front.
|
|
55
|
+
static VALUE behavior_is2d_p(VALUE self)
|
|
56
|
+
{
|
|
57
|
+
return BOOL2RB(behavior_get(self).component_snap != SUSnapToBehavior_None);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static VALUE behavior_set_is2d(VALUE self, VALUE value)
|
|
61
|
+
{
|
|
62
|
+
struct SUComponentBehavior b = behavior_get(self);
|
|
63
|
+
if (!RTEST(value))
|
|
64
|
+
b.component_snap = SUSnapToBehavior_None;
|
|
65
|
+
else if (b.component_snap == SUSnapToBehavior_None)
|
|
66
|
+
b.component_snap = SUSnapToBehavior_Any;
|
|
67
|
+
behavior_set(self, b);
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static VALUE behavior_snapto(VALUE self)
|
|
72
|
+
{
|
|
73
|
+
enum SUSnapToBehavior snap = behavior_get(self).component_snap;
|
|
74
|
+
return INT2FIX(snap == SUSnapToBehavior_None ? 0 : (int)snap - 1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
static VALUE behavior_set_snapto(VALUE self, VALUE value)
|
|
78
|
+
{
|
|
79
|
+
int snapto = NUM2INT(value);
|
|
80
|
+
if (snapto < 0 || snapto > 3)
|
|
81
|
+
rb_raise(rb_eArgError, "snapto must be between 0 and 3");
|
|
82
|
+
struct SUComponentBehavior b = behavior_get(self);
|
|
83
|
+
b.component_snap = (enum SUSnapToBehavior)(snapto + 1);
|
|
84
|
+
behavior_set(self, b);
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
void Init_behavior(void)
|
|
89
|
+
{
|
|
90
|
+
rb_define_method(cBehavior, "always_face_camera?", behavior_always_face_camera_p, 0);
|
|
91
|
+
rb_define_method(cBehavior, "always_face_camera=", behavior_set_always_face_camera, 1);
|
|
92
|
+
rb_define_method(cBehavior, "cuts_opening?", behavior_cuts_opening_p, 0);
|
|
93
|
+
rb_define_method(cBehavior, "cuts_opening=", behavior_set_cuts_opening, 1);
|
|
94
|
+
rb_define_method(cBehavior, "shadows_face_sun?", behavior_shadows_face_sun_p, 0);
|
|
95
|
+
rb_define_method(cBehavior, "shadows_face_sun=", behavior_set_shadows_face_sun, 1);
|
|
96
|
+
rb_define_method(cBehavior, "no_scale_mask?", behavior_no_scale_mask_p, 0);
|
|
97
|
+
rb_define_method(cBehavior, "no_scale_mask=", behavior_set_no_scale_mask, 1);
|
|
98
|
+
rb_define_method(cBehavior, "is2d?", behavior_is2d_p, 0);
|
|
99
|
+
rb_define_method(cBehavior, "is2d=", behavior_set_is2d, 1);
|
|
100
|
+
rb_define_method(cBehavior, "snapto", behavior_snapto, 0);
|
|
101
|
+
rb_define_method(cBehavior, "snapto=", behavior_set_snapto, 1);
|
|
102
|
+
}
|