{"id":18462510,"url":"https://github.com/thomthom/sketchupproxycommands","last_synced_at":"2025-04-28T11:14:05.015Z","repository":{"id":7824873,"uuid":"9195938","full_name":"thomthom/SketchUpProxyCommands","owner":"thomthom","description":null,"archived":false,"fork":false,"pushed_at":"2013-11-03T22:23:33.000Z","size":144,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-28T11:14:01.502Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomthom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-03T14:02:10.000Z","updated_at":"2013-11-03T22:23:36.000Z","dependencies_parsed_at":"2022-08-28T05:50:36.666Z","dependency_job_id":null,"html_url":"https://github.com/thomthom/SketchUpProxyCommands","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomthom%2FSketchUpProxyCommands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomthom%2FSketchUpProxyCommands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomthom%2FSketchUpProxyCommands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomthom%2FSketchUpProxyCommands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomthom","download_url":"https://codeload.github.com/thomthom/SketchUpProxyCommands/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251302782,"owners_count":21567601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T09:02:46.100Z","updated_at":"2025-04-28T11:14:04.996Z","avatar_url":"https://github.com/thomthom.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"SketchUp Proxy Commands\n=======================\n\n***\n\nModule Status: Draft (Work in Progress!)\n----------------------------------------\n\nThis module needs review and testing! Please hold distribution until design has\nbeen proven to work. But do share your thoughts.\n\n**Do not redistribute!**\n\n***\n\nThe purpose of this module is to create an interface where extensions that offer\nalternative modelling toolsets can hook into and use the keyboard shortcuts for\nthe native tools.\n\nFor instance, I developed an extension Vertex Tools that offered a toolset to\nmanipulate vertices in SketchUp. It reproduced many of the native tools such as\nMove, Rotate and Scale to work with vertices. These replacement tools created\nan alternative modelling environment, but a big workflow obstacle was that the\nuser could not use the same shortcuts for the native commands for the mirroring\nvertex commands. It was awkward to create all new keyboard shortcuts just for\nthe vertex tools.\n\nThe solution I made was to develop proxy tools and mapped the shortcuts to these\ncommands. If the user invoked the keyboard shortcut for Move and Vertex Tools\nwas active then Vertex Tools' Move tool would be active - otherwise the nativ\nMove tool would be used. This allowed for seamless worflow integration.\n\nThis module is a scalable version where any extension can hook up their\nalternative counterpart to the native SketchUp commands.\n\nExample\n-------\n\n```ruby\n# This proc should evaluate to true when the alternative replacement tool\n# is in a state where it can be activated.\nvalidation = Proc.new { self.is_mode_active? }\n\nproxy = CommunityExtensions::ProxyCommands\n\nproxy.register(:move_tool, validation) {\n  Sketchup.active_model.select_tool(MyCustomMoveTool.new)\n}\nproxy.register(:rotate_tool, validation) {\n  Sketchup.active_model.select_tool(MyCustomRotateTool.new)\n}\nproxy.register(:scale_tool, validation) {\n  Sketchup.active_model.select_tool(MyCustomScaleTool.new)\n}\n```\n\nUnder the Hood\n--------------\n\nThe module creates a set of menus for each command supported. The user can then\nassign keyboard shortcuts to these menus.\n\nWhen the command is invoked, either by accessing the menu or triggering the \nkeyboard shortcut the module will iterate each registered alternative for that\ncommand. It queries a validation proc which should return `true` or `false`.\n\nIf the validation proc returns true it indicates that it is ready to be called.\nFor instance, if Vertex Tools registered commands for Move, Rotate and Scale it\nwould return `true` in the validation proc is vertex editing mode was active.\n\nIt will keep iterating the list until it gets a reply the evaluates to `true`.\nIf a proxy command returns true then no other command will be evaluated. It's a\nfirst come first serve deal.\n\nIf there is no proxy commands that responds then the native SketchUp behaviour\nwill be triggered.\n\n**It is important that the namespace is preserved and not modified. Doing so\nwill result in multiple menu items.**\n\nAvailable Commands\n------------------\n\nTo list available commands:\n`CommunityExtensions::ProxyCommands::Commands.command_ids`\n\nBundling\n--------\n\nThis package is designed to be dropped into any other package and loaded without\nfurther modification to the `proxy_commands.rb` file. It has load guards that\nwill prevent older versions from overwriting newer versions. This off course\ndepends entirely that newer versions are made to be 100% backwards compatible.\n\nExtending\n---------\n\nIn order to ensure things do not break it is important that when adding new\ncommands that the names and design of this module is not changed.\n\n1. Add new commands to the ´Commands´ module.\n2. Hook it up to a menu.\n3. Bump the minor version number. (Bump the revision number only for bug fixes.)\n4. Make a pull request back to the main repository.\n   (https://github.com/thomthom/SketchUpProxyCommands)\n5. Once accepted, you can integrate and bundle the new extended version.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomthom%2Fsketchupproxycommands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomthom%2Fsketchupproxycommands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomthom%2Fsketchupproxycommands/lists"}