auvrynt 1.0.2 → 1.0.5
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.
- package/LICENSE +21 -21
- package/README.md +366 -233
- package/addons/auvrynt_bridge/auvrynt_bridge.gd +500 -0
- package/addons/auvrynt_bridge/plugin.cfg +7 -0
- package/bin/auvrynt-launcher.cjs +77 -0
- package/dist/artifact-registry.js +1 -0
- package/dist/aseprite-tools.js +1 -0
- package/dist/auth/connection-registry.js +145 -0
- package/dist/auth/connection-status.js +176 -0
- package/dist/auth/oauth-provider.js +617 -0
- package/dist/auth/room-registry.js +131 -0
- package/dist/auth/session-registry.js +531 -0
- package/dist/background-lifecycle.js +1 -0
- package/dist/blender-client.js +1 -109
- package/dist/blender-tools.js +1 -930
- package/dist/browser-stability.js +1 -0
- package/dist/cli/commands/help-command.js +10 -0
- package/dist/cli/commands/init-command.js +190 -0
- package/dist/cli/commands/integration-commands.js +88 -0
- package/dist/cli/commands/serve-command.js +83 -0
- package/dist/cli/commands/setup-command.js +81 -0
- package/dist/cli/commands/status-commands.js +166 -0
- package/dist/cli/commands/tunnel-command.js +127 -0
- package/dist/cli/commands/user-config-commands.js +105 -0
- package/dist/cli/dashboard-actions.js +516 -0
- package/dist/cli/dashboard-native-actions.js +282 -0
- package/dist/cli/foreground-server.js +270 -0
- package/dist/cli/instance-control.js +21 -0
- package/dist/cli/instance-lock.js +123 -0
- package/dist/cli/integration-bootstrap.js +206 -0
- package/dist/cli/lifecycle-manager.js +493 -0
- package/dist/cli/runtime-support.js +74 -0
- package/dist/cli/serena-detected-default.js +27 -0
- package/dist/cli/tunnel-health-monitor.js +182 -0
- package/dist/cli.js +82 -739
- package/dist/config.js +1 -243
- package/dist/connection-registry.js +1 -73
- package/dist/connection-status.js +1 -139
- package/dist/control-retry.js +1 -0
- package/dist/crash-recovery.js +1 -0
- package/dist/db/client.js +16 -3
- package/dist/db/schema.js +30 -0
- package/dist/dotnet-tools.js +1 -223
- package/dist/git-worktrees.js +1 -134
- package/dist/git.js +1 -41
- package/dist/godot-animation-tilemap.js +1 -82
- package/dist/godot-csharp-build.js +1 -93
- package/dist/godot-csharp-project.js +1 -157
- package/dist/godot-csharp-runner.js +1 -146
- package/dist/godot-csharp-semantic.js +1 -161
- package/dist/godot-csharp-validate.js +1 -71
- package/dist/godot-dotnet-env.js +1 -169
- package/dist/godot-editor-bridge.js +1 -140
- package/dist/godot-gdscript.js +1 -824
- package/dist/godot-project-settings.js +1 -223
- package/dist/godot-runtime-testing.js +1 -249
- package/dist/godot-tools.js +1 -183
- package/dist/http-rate-limit.js +1 -0
- package/dist/http-server-hardening.js +1 -0
- package/dist/image-tools.js +1 -157
- package/dist/infrastructure/command-reference.js +32 -0
- package/dist/infrastructure/config.js +424 -0
- package/dist/infrastructure/context7-auth.js +55 -0
- package/dist/infrastructure/http-rate-limit.js +42 -0
- package/dist/infrastructure/http-server-hardening.js +23 -0
- package/dist/infrastructure/integration-queue.js +46 -0
- package/dist/infrastructure/logger.js +129 -0
- package/dist/infrastructure/mcp-event-store.js +103 -0
- package/dist/infrastructure/ngrok-auth-pool.js +208 -0
- package/dist/infrastructure/request-context.js +14 -0
- package/dist/infrastructure/shutdown.js +37 -0
- package/dist/infrastructure/sse-heartbeat.js +47 -0
- package/dist/infrastructure/tool-capabilities.js +67 -0
- package/dist/infrastructure/tool-result-budget.js +175 -0
- package/dist/infrastructure/user-config.js +167 -0
- package/dist/integration-discovery.js +1 -98
- package/dist/integration-queue.js +1 -0
- package/dist/integrations/agent-reach/agent-reach-tools.js +196 -0
- package/dist/integrations/agent-reach/native-channels.js +468 -0
- package/dist/integrations/aseprite/aseprite-analysis-tools.js +368 -0
- package/dist/integrations/aseprite/aseprite-editing-tools.js +647 -0
- package/dist/integrations/aseprite/aseprite-live-tools.js +297 -0
- package/dist/integrations/aseprite/aseprite-safety-tools.js +594 -0
- package/dist/integrations/aseprite/aseprite-specialized-tools.js +289 -0
- package/dist/integrations/aseprite/aseprite-tools.js +837 -0
- package/dist/integrations/blender/blender-catalog-mesh.js +593 -0
- package/dist/integrations/blender/blender-catalog-object.js +906 -0
- package/dist/integrations/blender/blender-catalog-scene.js +266 -0
- package/dist/integrations/blender/blender-catalog-select.js +581 -0
- package/dist/integrations/blender/blender-catalog-stubs.js +7512 -0
- package/dist/integrations/blender/blender-catalog.js +165 -0
- package/dist/integrations/blender/blender-client.js +105 -0
- package/dist/integrations/blender/blender-tools.js +2243 -0
- package/dist/integrations/context7/context7-tools.js +106 -0
- package/dist/integrations/dotnet/dotnet-tools.js +195 -0
- package/dist/integrations/godot/godot-animation-tilemap.js +74 -0
- package/dist/integrations/godot/godot-csharp-build.js +91 -0
- package/dist/integrations/godot/godot-csharp-project.js +155 -0
- package/dist/integrations/godot/godot-csharp-runner.js +118 -0
- package/dist/integrations/godot/godot-csharp-semantic.js +146 -0
- package/dist/integrations/godot/godot-csharp-validate.js +71 -0
- package/dist/integrations/godot/godot-dotnet-env.js +134 -0
- package/dist/integrations/godot/godot-editor-bridge.js +328 -0
- package/dist/integrations/godot/godot-gdscript.js +536 -0
- package/dist/integrations/godot/godot-project-settings.js +178 -0
- package/dist/integrations/godot/godot-runtime-testing.js +263 -0
- package/dist/integrations/godot/godot-tools.js +193 -0
- package/dist/integrations/images/image-tools.js +414 -0
- package/dist/integrations/images/png-codec.js +251 -0
- package/dist/integrations/images/view-image.js +99 -0
- package/dist/integrations/images/window-capture.js +148 -0
- package/dist/integrations/integration-discovery.js +185 -0
- package/dist/integrations/obsidian/obsidian-tools.js +205 -0
- package/dist/integrations/playwright/browser-session.js +516 -0
- package/dist/integrations/playwright/browser-stability.js +36 -0
- package/dist/integrations/playwright/playwright-runtime.js +105 -0
- package/dist/integrations/playwright/web-tools.js +504 -0
- package/dist/integrations/roblox/roblox-helpers.js +381 -0
- package/dist/integrations/roblox/roblox-studio-client.js +112 -0
- package/dist/integrations/roblox/roblox-tools.js +106 -0
- package/dist/integrations/serena/serena-manager.js +464 -0
- package/dist/integrations/serena/serena-tools.js +411 -0
- package/dist/logger.js +1 -76
- package/dist/mcp-event-store.js +1 -0
- package/dist/oauth-provider.js +1 -377
- package/dist/pi-tools.js +1 -81
- package/dist/playwright-runtime.js +1 -0
- package/dist/process/background-lifecycle.js +189 -0
- package/dist/process/control-retry.js +42 -0
- package/dist/process/crash-recovery.js +23 -0
- package/dist/process/processes.js +456 -0
- package/dist/processes.js +1 -218
- package/dist/request-context.js +1 -0
- package/dist/review-checkpoints.js +1 -142
- package/dist/room-registry.js +1 -0
- package/dist/roots.js +1 -53
- package/dist/search-discovery.js +1 -271
- package/dist/serena-manager.js +1 -443
- package/dist/serena-tools.js +1 -411
- package/dist/server/dashboard-page-styles.js +331 -0
- package/dist/server/dashboard-page.js +1509 -0
- package/dist/server/dashboard-routes.js +46 -0
- package/dist/server/dashboard.js +240 -0
- package/dist/server/http-helpers.js +30 -0
- package/dist/server/integration-profile-update.js +37 -0
- package/dist/server/mcp-policy.js +169 -0
- package/dist/server/mcp-server-factory.js +127 -0
- package/dist/server/mcp-tool-registrar.js +182 -0
- package/dist/server/openai-session-hint.js +14 -0
- package/dist/server/tool-groups.js +29 -0
- package/dist/server/tool-logging.js +33 -0
- package/dist/server/tool-registration-shared.js +59 -0
- package/dist/server/tools/aseprite-advanced-tools-registration.js +547 -0
- package/dist/server/tools/aseprite-tools-registration.js +213 -0
- package/dist/server/tools/blender-tools-registration.js +690 -0
- package/dist/server/tools/core-file-tools-registration.js +459 -0
- package/dist/server/tools/dotnet-godot-window-tools-registration.js +120 -0
- package/dist/server/tools/godot-csharp-tools-registration.js +252 -0
- package/dist/server/tools/godot-gdscript-tools-registration.js +189 -0
- package/dist/server/tools/process-project-tools-registration.js +155 -0
- package/dist/server/tools/roblox-tools-registration.js +514 -0
- package/dist/server/tools/web-image-tools-registration.js +326 -0
- package/dist/server/tools/workspace-lifecycle-tools-registration.js +130 -0
- package/dist/server/ui-assets.js +97 -0
- package/dist/server/workspace-analytics.js +92 -0
- package/dist/server.js +453 -2713
- package/dist/session-registry.js +1 -0
- package/dist/shutdown.js +1 -0
- package/dist/skills.js +1 -45
- package/dist/sse-heartbeat.js +1 -0
- package/dist/tool-capabilities.js +1 -0
- package/dist/tool-result-budget.js +1 -0
- package/dist/tools/pi-tools.js +81 -0
- package/dist/tunnels/cloudflare-tunnel.js +217 -0
- package/dist/tunnels/cloudflared-service.js +174 -0
- package/dist/tunnels/ngrok-tunnel.js +220 -0
- package/dist/tunnels/tunnel-manager.js +186 -0
- package/dist/tunnels/tunnel-types.js +1 -0
- package/dist/tunnels/tunnel-utils.js +62 -0
- package/dist/ui/.vite/manifest.json +9 -2487
- package/dist/ui/assets/heavy-payload-D42A9ceL.js +1 -0
- package/dist/ui/assets/lightweight-diff-Cv4g9Hdr.js +13 -0
- package/dist/ui/assets/review-payload-DKIg1cKF.js +1 -0
- package/dist/ui/assets/workspace-app-CeK3NhmB.css +1 -0
- package/dist/ui/assets/{workspace-app-C5QsE314.js → workspace-app-CkUXnpl4.js} +6 -6
- package/dist/ui/brand-theme.js +23 -0
- package/dist/ui/workspace-app.html +15 -15
- package/dist/user-config.js +1 -57
- package/dist/view-image.js +1 -104
- package/dist/web-tools.js +1 -200
- package/dist/window-capture.js +1 -74
- package/dist/workspace/artifact-registry.js +69 -0
- package/dist/workspace/git-worktrees.js +141 -0
- package/dist/workspace/git.js +42 -0
- package/dist/workspace/review-checkpoints.js +142 -0
- package/dist/workspace/roots.js +56 -0
- package/dist/workspace/search-discovery.js +264 -0
- package/dist/workspace/skills.js +45 -0
- package/dist/workspace/workspace-store.js +219 -0
- package/dist/workspace/workspaces.js +314 -0
- package/dist/workspace-store.js +1 -125
- package/dist/workspaces.js +1 -226
- package/docs/CREATOR_STORE_FREE_ASSETS.md +162 -0
- package/docs/DEVELOPMENT_TOOLS.md +136 -93
- package/docs/assets/auvrynt-icon.png +0 -0
- package/docs/assets/auvrynt-icon.svg +20 -0
- package/docs/chatgpt-coding-workflow.md +143 -143
- package/docs/configuration.md +156 -124
- package/docs/diagnostics.md +79 -0
- package/docs/gotchas.md +244 -202
- package/docs/multi-agent-and-long-projects.md +91 -0
- package/docs/security.md +138 -100
- package/docs/setup.md +171 -131
- package/docs/source-layout.md +60 -0
- package/extensions/auvrynt_bridge/auvrynt_bridge.lua +594 -0
- package/extensions/auvrynt_bridge/live_analysis.lua +181 -0
- package/extensions/auvrynt_bridge/live_animation.lua +134 -0
- package/extensions/auvrynt_bridge/live_commands.lua +24 -0
- package/extensions/auvrynt_bridge/live_common.lua +130 -0
- package/extensions/auvrynt_bridge/live_document.lua +78 -0
- package/extensions/auvrynt_bridge/live_drawing.lua +125 -0
- package/extensions/auvrynt_bridge/live_effects.lua +91 -0
- package/extensions/auvrynt_bridge/live_palette_template.lua +167 -0
- package/extensions/auvrynt_bridge/live_selection.lua +110 -0
- package/extensions/auvrynt_bridge/live_structure.lua +129 -0
- package/extensions/auvrynt_bridge/package.json +17 -0
- package/guides/ASEPRITE_AGENT_GUIDE.md +133 -0
- package/guides/BLENDER_AGENT_GUIDE.md +472 -0
- package/guides/GODOT_AGENT_GUIDE.md +298 -0
- package/guides/PROJECT_ROUTER.md +165 -0
- package/guides/ROBLOX_AGENT_GUIDE.md +75 -0
- package/guides/SOFTWARE_AGENT_GUIDE.md +104 -0
- package/guides/WEB_AGENT_GUIDE.md +287 -0
- package/package.json +78 -70
- package/scripts/dev-server.mjs +121 -120
- package/scripts/live-tunnel-smoke.mjs +538 -0
- package/scripts/repo-hygiene.mjs +74 -0
- package/scripts/restart-after-crash.mjs +49 -0
- package/scripts/run-tests.mjs +166 -0
- package/dist/ui/assets/abap-CLvhMVsD.js +0 -1
- package/dist/ui/assets/actionscript-3--17pq3dv.js +0 -1
- package/dist/ui/assets/ada-C5qYipkI.js +0 -1
- package/dist/ui/assets/andromeeda-vGVdxbeo.js +0 -1
- package/dist/ui/assets/angular-html-BJqQFYI6.js +0 -1
- package/dist/ui/assets/angular-ts-CMJECO0Y.js +0 -1
- package/dist/ui/assets/apache-U0d_L8uA.js +0 -1
- package/dist/ui/assets/apex-CGTLDQj6.js +0 -1
- package/dist/ui/assets/apl-DWeXpBBr.js +0 -1
- package/dist/ui/assets/applescript-CCn79oCD.js +0 -1
- package/dist/ui/assets/ara-4CJ0cIlV.js +0 -1
- package/dist/ui/assets/asciidoc-DE70LPWp.js +0 -1
- package/dist/ui/assets/asm-Cmm7eHzH.js +0 -1
- package/dist/ui/assets/astro-CLbttLOq.js +0 -1
- package/dist/ui/assets/aurora-x-CDeNXAV0.js +0 -1
- package/dist/ui/assets/awk-BWXHIvNe.js +0 -1
- package/dist/ui/assets/ayu-dark-DluEY0Gj.js +0 -1
- package/dist/ui/assets/ayu-light-C3h-C4tm.js +0 -1
- package/dist/ui/assets/ayu-mirage-Bqwy1Gya.js +0 -1
- package/dist/ui/assets/ballerina-B7ZEbQpA.js +0 -1
- package/dist/ui/assets/bat-Bo4NYOV-.js +0 -1
- package/dist/ui/assets/beancount-D-usSTwE.js +0 -1
- package/dist/ui/assets/berry-DKpUyyne.js +0 -1
- package/dist/ui/assets/bibtex-Ci_nEsc7.js +0 -1
- package/dist/ui/assets/bicep-CUHmPFLl.js +0 -1
- package/dist/ui/assets/bird2-C2hNVINV.js +0 -1
- package/dist/ui/assets/blade-BOzY0P2V.js +0 -1
- package/dist/ui/assets/bsl-BkkzgIyY.js +0 -1
- package/dist/ui/assets/c-BG-8uJvh.js +0 -1
- package/dist/ui/assets/c3-CnJL0r0V.js +0 -1
- package/dist/ui/assets/cadence-CQ2zXKGN.js +0 -1
- package/dist/ui/assets/cairo-DLTphjLi.js +0 -1
- package/dist/ui/assets/catppuccin-frappe-3VR1Za6u.js +0 -1
- package/dist/ui/assets/catppuccin-latte-DwIHMF0Q.js +0 -1
- package/dist/ui/assets/catppuccin-macchiato-DYnBP6_5.js +0 -1
- package/dist/ui/assets/catppuccin-mocha-DYhrFGRu.js +0 -1
- package/dist/ui/assets/clarity-SemFz856.js +0 -1
- package/dist/ui/assets/clojure-DqKBuwfJ.js +0 -1
- package/dist/ui/assets/cmake-Bj61d0ZC.js +0 -1
- package/dist/ui/assets/cobol-I_17IuGe.js +0 -1
- package/dist/ui/assets/codeowners-C8r90Shi.js +0 -1
- package/dist/ui/assets/codeql-oeQT6MSM.js +0 -1
- package/dist/ui/assets/coffee-C0B8hmok.js +0 -1
- package/dist/ui/assets/common-lisp-Cv5bFMCO.js +0 -1
- package/dist/ui/assets/coq-BrsZFFmf.js +0 -1
- package/dist/ui/assets/cpp-DDJXt6Vs.js +0 -1
- package/dist/ui/assets/crystal-Bexqace6.js +0 -1
- package/dist/ui/assets/csharp-Ct8U2NOr.js +0 -1
- package/dist/ui/assets/css-DSQhw_9R.js +0 -1
- package/dist/ui/assets/csv-Dx-8-gkx.js +0 -1
- package/dist/ui/assets/cue-CE9AQfxI.js +0 -1
- package/dist/ui/assets/cypher-ClKdZ_lG.js +0 -1
- package/dist/ui/assets/d-qD-0Kul2.js +0 -1
- package/dist/ui/assets/dark-plus-Cs2F2srj.js +0 -1
- package/dist/ui/assets/dart-DkHntEIa.js +0 -1
- package/dist/ui/assets/dax-BkyTk9wS.js +0 -1
- package/dist/ui/assets/desktop-Dlh5hvp9.js +0 -1
- package/dist/ui/assets/diff-woXpYk--.js +0 -1
- package/dist/ui/assets/docker-IyjqRm3v.js +0 -1
- package/dist/ui/assets/dotenv-_5a1GRtc.js +0 -1
- package/dist/ui/assets/dracula-BHWKrbxM.js +0 -1
- package/dist/ui/assets/dracula-soft-5eyTD99u.js +0 -1
- package/dist/ui/assets/dream-maker-DW3nJb8Q.js +0 -1
- package/dist/ui/assets/edge-Z8YYkHOr.js +0 -1
- package/dist/ui/assets/elixir-CG9uKtAF.js +0 -1
- package/dist/ui/assets/elm-GfWG2IfT.js +0 -1
- package/dist/ui/assets/emacs-lisp-C9PiwqqW.js +0 -1
- package/dist/ui/assets/erb-xe89e73J.js +0 -1
- package/dist/ui/assets/erlang-Cphh6RMH.js +0 -1
- package/dist/ui/assets/everforest-dark-sB-x3p7T.js +0 -1
- package/dist/ui/assets/everforest-light-Df2xbC6M.js +0 -1
- package/dist/ui/assets/fennel-DQxkIbk2.js +0 -1
- package/dist/ui/assets/fish-BJitypiv.js +0 -1
- package/dist/ui/assets/fluent-C03EYrpw.js +0 -1
- package/dist/ui/assets/fortran-fixed-form-DEKoE2YW.js +0 -1
- package/dist/ui/assets/fortran-free-form-CYNrtFtB.js +0 -1
- package/dist/ui/assets/fsharp-D13ZGOAj.js +0 -1
- package/dist/ui/assets/gdresource-C0sCabJj.js +0 -1
- package/dist/ui/assets/gdscript-Cp2uCuqX.js +0 -1
- package/dist/ui/assets/gdshader-CBce3t8t.js +0 -1
- package/dist/ui/assets/genie-CV2tkWYe.js +0 -1
- package/dist/ui/assets/gherkin-DExj1W_8.js +0 -1
- package/dist/ui/assets/git-commit-BSykSTBG.js +0 -1
- package/dist/ui/assets/git-rebase-CoTL_uSE.js +0 -1
- package/dist/ui/assets/github-dark-C-LZuMrd.js +0 -1
- package/dist/ui/assets/github-dark-default-DXG-b-1a.js +0 -1
- package/dist/ui/assets/github-dark-dimmed-Bx1FflLF.js +0 -1
- package/dist/ui/assets/github-dark-high-contrast-B_tTalzw.js +0 -1
- package/dist/ui/assets/github-light-EUqPIrTm.js +0 -1
- package/dist/ui/assets/github-light-default-BXViO-2h.js +0 -1
- package/dist/ui/assets/github-light-high-contrast-B68TUdTA.js +0 -1
- package/dist/ui/assets/gleam-CSRkHgEL.js +0 -1
- package/dist/ui/assets/glimmer-js-DAn4UCSu.js +0 -1
- package/dist/ui/assets/glimmer-ts-Tjyi6Gh5.js +0 -1
- package/dist/ui/assets/glsl-CtTDZoqR.js +0 -1
- package/dist/ui/assets/gn-ilITqXS6.js +0 -1
- package/dist/ui/assets/gnuplot-7GGW24-e.js +0 -1
- package/dist/ui/assets/go-BJwz_mda.js +0 -1
- package/dist/ui/assets/graphql-D5gcC_Jk.js +0 -1
- package/dist/ui/assets/groovy-CacY0gHj.js +0 -1
- package/dist/ui/assets/gruvbox-dark-hard-C820rvS2.js +0 -1
- package/dist/ui/assets/gruvbox-dark-medium-BPjhmG05.js +0 -1
- package/dist/ui/assets/gruvbox-dark-soft-MrdJrrXF.js +0 -1
- package/dist/ui/assets/gruvbox-light-hard-BC_s9l72.js +0 -1
- package/dist/ui/assets/gruvbox-light-medium-BAWPOn9u.js +0 -1
- package/dist/ui/assets/gruvbox-light-soft-BSMLrYjP.js +0 -1
- package/dist/ui/assets/hack-BJXY27dt.js +0 -1
- package/dist/ui/assets/haml-BLfFoZf7.js +0 -1
- package/dist/ui/assets/handlebars-Dw6CWkvN.js +0 -1
- package/dist/ui/assets/haskell-D8IpX4py.js +0 -1
- package/dist/ui/assets/haxe-OTjmBuCE.js +0 -1
- package/dist/ui/assets/hcl-Dh228itO.js +0 -1
- package/dist/ui/assets/heavy-payload-Dcg0-F-S.js +0 -4
- package/dist/ui/assets/hjson-CxZEssPk.js +0 -1
- package/dist/ui/assets/hlsl-Cvrh5tZx.js +0 -1
- package/dist/ui/assets/horizon-CE9ld1lL.js +0 -1
- package/dist/ui/assets/horizon-bright-Br1oVSNq.js +0 -1
- package/dist/ui/assets/houston-CsvMBhTu.js +0 -1
- package/dist/ui/assets/html-CAcAWvoN.js +0 -1
- package/dist/ui/assets/html-derivative-8aSW2E_7.js +0 -1
- package/dist/ui/assets/http-B2YR_3V1.js +0 -1
- package/dist/ui/assets/hurl-BnDJ9Zhf.js +0 -1
- package/dist/ui/assets/hxml-B0Qn7Nwc.js +0 -1
- package/dist/ui/assets/hy-CZbG8q4J.js +0 -1
- package/dist/ui/assets/imba-DsUTQ-LC.js +0 -1
- package/dist/ui/assets/ini-B5eOa1yu.js +0 -1
- package/dist/ui/assets/java-Doxi4W8u.js +0 -1
- package/dist/ui/assets/javascript-BbRdEqti.js +0 -1
- package/dist/ui/assets/jinja-CS3Tpv_Q.js +0 -1
- package/dist/ui/assets/jison-BkPGYVHR.js +0 -1
- package/dist/ui/assets/json-BMt1m3m8.js +0 -1
- package/dist/ui/assets/json5-BR5RXkoi.js +0 -1
- package/dist/ui/assets/jsonc-CYpm1nAK.js +0 -1
- package/dist/ui/assets/jsonl-CmCQp5Yx.js +0 -1
- package/dist/ui/assets/jsonnet-CJTPZ8u_.js +0 -1
- package/dist/ui/assets/jssm-DXw9l8Rf.js +0 -1
- package/dist/ui/assets/jsx-CQKrJXXY.js +0 -1
- package/dist/ui/assets/julia-BuN7i2du.js +0 -1
- package/dist/ui/assets/just-BswEPFPu.js +0 -1
- package/dist/ui/assets/kanagawa-dragon-CXtmUGW6.js +0 -1
- package/dist/ui/assets/kanagawa-lotus-BN08jTvb.js +0 -1
- package/dist/ui/assets/kanagawa-wave-CTweb8Dz.js +0 -1
- package/dist/ui/assets/kdl-CsD5j6eV.js +0 -1
- package/dist/ui/assets/kotlin-DhhofPvG.js +0 -1
- package/dist/ui/assets/kusto-BUv0MjJC.js +0 -1
- package/dist/ui/assets/laserwave-C_8bwKvT.js +0 -1
- package/dist/ui/assets/latex-DU2VyFfA.js +0 -1
- package/dist/ui/assets/lean-CewbzKMR.js +0 -1
- package/dist/ui/assets/less-DVTAwKKz.js +0 -1
- package/dist/ui/assets/light-plus-DVQuIRkW.js +0 -1
- package/dist/ui/assets/liquid-Cmz1L3dq.js +0 -1
- package/dist/ui/assets/llvm-Cm23YOpf.js +0 -1
- package/dist/ui/assets/log-BNLmms1o.js +0 -1
- package/dist/ui/assets/logo-Cluzi2Zq.js +0 -1
- package/dist/ui/assets/lua-CfVXhkaJ.js +0 -1
- package/dist/ui/assets/luau-CNKltnaQ.js +0 -1
- package/dist/ui/assets/make-Dixweg8N.js +0 -1
- package/dist/ui/assets/markdown-BYOwaDjH.js +0 -1
- package/dist/ui/assets/marko-C5bfqGiA.js +0 -1
- package/dist/ui/assets/material-theme-Bm3Qr25_.js +0 -1
- package/dist/ui/assets/material-theme-darker-2IIEA8gg.js +0 -1
- package/dist/ui/assets/material-theme-lighter-uhdI0v04.js +0 -1
- package/dist/ui/assets/material-theme-ocean-CHQ94UKr.js +0 -1
- package/dist/ui/assets/material-theme-palenight-B5W6OYN7.js +0 -1
- package/dist/ui/assets/matlab-D7qyCx1q.js +0 -1
- package/dist/ui/assets/mdc-CVBXYfyq.js +0 -1
- package/dist/ui/assets/mdx-DQZ5AkYe.js +0 -1
- package/dist/ui/assets/mermaid-Bk4SNUv9.js +0 -1
- package/dist/ui/assets/min-dark-BSWPekZh.js +0 -1
- package/dist/ui/assets/min-light-DDpmG2fV.js +0 -1
- package/dist/ui/assets/mipsasm-BMqwQI7S.js +0 -1
- package/dist/ui/assets/mojo-BgCJLMeH.js +0 -1
- package/dist/ui/assets/monokai-CdkpiU2Y.js +0 -1
- package/dist/ui/assets/moonbit-CaWjb8XO.js +0 -1
- package/dist/ui/assets/move-B1IS1UjX.js +0 -1
- package/dist/ui/assets/narrat-_X_XdTYD.js +0 -1
- package/dist/ui/assets/nextflow-Bbiyy34d.js +0 -1
- package/dist/ui/assets/nextflow-groovy-Dc_ddanL.js +0 -1
- package/dist/ui/assets/nginx-CzJafxLa.js +0 -1
- package/dist/ui/assets/night-owl-DhmEMT88.js +0 -1
- package/dist/ui/assets/night-owl-light-eJ-hLW7d.js +0 -1
- package/dist/ui/assets/nim-DABKtHtM.js +0 -1
- package/dist/ui/assets/nix-IvuFDN5E.js +0 -1
- package/dist/ui/assets/nord-Cb4Vim4T.js +0 -1
- package/dist/ui/assets/nushell-DcLAeLz5.js +0 -1
- package/dist/ui/assets/objective-c-D1A_Heim.js +0 -1
- package/dist/ui/assets/objective-cpp-BsSzOQcm.js +0 -1
- package/dist/ui/assets/ocaml-O90oeIOV.js +0 -1
- package/dist/ui/assets/odin-B1RWQWA5.js +0 -1
- package/dist/ui/assets/one-dark-pro-CLwyXe_n.js +0 -1
- package/dist/ui/assets/one-light-D7Lr4KcI.js +0 -1
- package/dist/ui/assets/openscad-BUDT5pXO.js +0 -1
- package/dist/ui/assets/pascal-4ZHwLPI5.js +0 -1
- package/dist/ui/assets/perl-CBh7L3lZ.js +0 -1
- package/dist/ui/assets/php-DFbI9q5p.js +0 -1
- package/dist/ui/assets/pierre-dark-sU4Zdns8.js +0 -1
- package/dist/ui/assets/pierre-dark-soft-HXgun5vs.js +0 -1
- package/dist/ui/assets/pierre-light-DWBk51d8.js +0 -1
- package/dist/ui/assets/pierre-light-soft-CodEzPxf.js +0 -1
- package/dist/ui/assets/pkl-ot-7Btpt.js +0 -1
- package/dist/ui/assets/plastic-DQwYfKfQ.js +0 -1
- package/dist/ui/assets/plsql-DGHpHOYJ.js +0 -1
- package/dist/ui/assets/po-BiJDBrnU.js +0 -1
- package/dist/ui/assets/poimandres-DRFjx7u4.js +0 -1
- package/dist/ui/assets/polar-C7UOKdEL.js +0 -1
- package/dist/ui/assets/postcss-BXeXVLqQ.js +0 -1
- package/dist/ui/assets/powerquery-DNMTfnFr.js +0 -1
- package/dist/ui/assets/powershell-DshXNtvi.js +0 -1
- package/dist/ui/assets/prisma-BsRQq5mF.js +0 -1
- package/dist/ui/assets/prolog-iXnhIJG7.js +0 -1
- package/dist/ui/assets/proto-DB4EqR-F.js +0 -1
- package/dist/ui/assets/pug-C_PxC7gO.js +0 -1
- package/dist/ui/assets/puppet-CDv2pdJW.js +0 -1
- package/dist/ui/assets/purescript-9MfHhQsQ.js +0 -1
- package/dist/ui/assets/python-gzcpVVnB.js +0 -1
- package/dist/ui/assets/qml-DtngoFFK.js +0 -1
- package/dist/ui/assets/qmldir-DCQb3MpD.js +0 -1
- package/dist/ui/assets/qss-Fe1Jh2GI.js +0 -1
- package/dist/ui/assets/r-DohkcevW.js +0 -1
- package/dist/ui/assets/racket-DcIDlBhZ.js +0 -1
- package/dist/ui/assets/raku-B3gFvitq.js +0 -1
- package/dist/ui/assets/razor-C4t8J0_E.js +0 -1
- package/dist/ui/assets/red-CJ3rzSJv.js +0 -1
- package/dist/ui/assets/reg-CRGYupPL.js +0 -1
- package/dist/ui/assets/regexp-OGbTbjgY.js +0 -1
- package/dist/ui/assets/rel-BtDbiS_P.js +0 -1
- package/dist/ui/assets/review-payload-C5Qz60Kq.js +0 -1
- package/dist/ui/assets/riscv-Ckw8ddFX.js +0 -1
- package/dist/ui/assets/ron-VUp2lXgN.js +0 -1
- package/dist/ui/assets/rose-pine-BthvhNj6.js +0 -1
- package/dist/ui/assets/rose-pine-dawn-Dg85fqjY.js +0 -1
- package/dist/ui/assets/rose-pine-moon-hon4tzzS.js +0 -1
- package/dist/ui/assets/rosmsg-CAekHB0j.js +0 -1
- package/dist/ui/assets/rst-CfBbbcvC.js +0 -1
- package/dist/ui/assets/ruby-Bw0mpxHY.js +0 -1
- package/dist/ui/assets/rust-Cfkwpbl8.js +0 -1
- package/dist/ui/assets/sas-Cs3s9JOf.js +0 -1
- package/dist/ui/assets/sass-DXrisJhu.js +0 -1
- package/dist/ui/assets/scala-DKOlJaKm.js +0 -1
- package/dist/ui/assets/scheme-DQCgrYNe.js +0 -1
- package/dist/ui/assets/scss-sRxNJS54.js +0 -1
- package/dist/ui/assets/sdbl-bTVj8UrX.js +0 -1
- package/dist/ui/assets/shaderlab-TOUzSsQk.js +0 -1
- package/dist/ui/assets/shellscript-B0X6wh0R.js +0 -1
- package/dist/ui/assets/shellsession-D2FdOioR.js +0 -1
- package/dist/ui/assets/slack-dark-DnToyrRv.js +0 -1
- package/dist/ui/assets/slack-ochin-B2OO5cIa.js +0 -1
- package/dist/ui/assets/smalltalk-B16xEiuN.js +0 -1
- package/dist/ui/assets/snazzy-light-4G7pJPwS.js +0 -1
- package/dist/ui/assets/solarized-dark-DV17i1UV.js +0 -1
- package/dist/ui/assets/solarized-light-DSh2HLQt.js +0 -1
- package/dist/ui/assets/solidity-CKzVLygQ.js +0 -1
- package/dist/ui/assets/soy-s6g9OjJ1.js +0 -1
- package/dist/ui/assets/sparql-D_iOobhT.js +0 -1
- package/dist/ui/assets/splunk-BC2Px7Mm.js +0 -1
- package/dist/ui/assets/sql-DVTnh5V-.js +0 -1
- package/dist/ui/assets/ssh-config-BgfXC-Er.js +0 -1
- package/dist/ui/assets/stata-DFIDiXF9.js +0 -1
- package/dist/ui/assets/stylus-B6D30XZt.js +0 -1
- package/dist/ui/assets/surrealql-DVfrsLyg.js +0 -1
- package/dist/ui/assets/svelte-D5GsxESq.js +0 -1
- package/dist/ui/assets/swift-DonLKvLd.js +0 -1
- package/dist/ui/assets/synthwave-84-nFMaYfgc.js +0 -1
- package/dist/ui/assets/system-verilog-DJ5XKQeo.js +0 -1
- package/dist/ui/assets/systemd-BxMlprV5.js +0 -1
- package/dist/ui/assets/talonscript-CohzipZa.js +0 -1
- package/dist/ui/assets/tasl-DMoTqEGO.js +0 -1
- package/dist/ui/assets/tcl-CZd0xW_V.js +0 -1
- package/dist/ui/assets/templ-DI-Zyqzd.js +0 -1
- package/dist/ui/assets/terraform-DswuEJGm.js +0 -1
- package/dist/ui/assets/tex-WHHmlbJI.js +0 -1
- package/dist/ui/assets/tokyo-night-oM2G3aXe.js +0 -1
- package/dist/ui/assets/toml-CcmNWLt0.js +0 -1
- package/dist/ui/assets/ts-tags-Dwpo2RFJ.js +0 -1
- package/dist/ui/assets/tsv-sltzmVWM.js +0 -1
- package/dist/ui/assets/tsx-ph_idaAW.js +0 -1
- package/dist/ui/assets/turtle-ByJddavk.js +0 -1
- package/dist/ui/assets/twig-YO17jFjR.js +0 -1
- package/dist/ui/assets/typescript-CbAxjhkl.js +0 -1
- package/dist/ui/assets/typespec-B88KGewJ.js +0 -1
- package/dist/ui/assets/typst-DI99ib-x.js +0 -1
- package/dist/ui/assets/useFileDiffInstance-B2DLX3Vg.js +0 -244
- package/dist/ui/assets/v-DETTlOr0.js +0 -1
- package/dist/ui/assets/vala-zf12oZj6.js +0 -1
- package/dist/ui/assets/vb-Djn5o6TS.js +0 -1
- package/dist/ui/assets/verilog-CiiDBU1e.js +0 -1
- package/dist/ui/assets/vesper-D5bVUKB1.js +0 -1
- package/dist/ui/assets/vhdl-BroJfC0k.js +0 -1
- package/dist/ui/assets/viml-DvXPmvsu.js +0 -1
- package/dist/ui/assets/vitesse-black-fwtXNY1n.js +0 -1
- package/dist/ui/assets/vitesse-dark-BZCL-v6S.js +0 -1
- package/dist/ui/assets/vitesse-light-VbXTXTou.js +0 -1
- package/dist/ui/assets/vue-CraHL-Ps.js +0 -1
- package/dist/ui/assets/vue-html-e9tyZNtS.js +0 -1
- package/dist/ui/assets/vue-vine-CofmxaUb.js +0 -1
- package/dist/ui/assets/vyper-CgoNMtux.js +0 -1
- package/dist/ui/assets/wasm-BnjxR4X6.js +0 -1
- package/dist/ui/assets/wasm-ByWQv1Qj.js +0 -1
- package/dist/ui/assets/wenyan-C8pVoKbM.js +0 -1
- package/dist/ui/assets/wgsl-BsKzXJz4.js +0 -1
- package/dist/ui/assets/wikitext-ClFFjSW2.js +0 -1
- package/dist/ui/assets/wit-DdvCle-K.js +0 -1
- package/dist/ui/assets/wolfram-DLL8P-h_.js +0 -1
- package/dist/ui/assets/workspace-app-8--oTbCd.css +0 -1
- package/dist/ui/assets/xml-BWSdPZHm.js +0 -1
- package/dist/ui/assets/xsl-BtCt7Hx8.js +0 -1
- package/dist/ui/assets/yaml-BZiTw7cQ.js +0 -1
- package/dist/ui/assets/zenscript-BnlCZFoB.js +0 -1
- package/dist/ui/assets/zig-CMLA9XwU.js +0 -1
- package/docs/assets/auvrynt-logo-light.png +0 -0
- package/docs/assets/auvrynt-screenshot.png +0 -0
|
@@ -0,0 +1,906 @@
|
|
|
1
|
+
const objModePrelude = "import bpy\n" +
|
|
2
|
+
"if bpy.ops.object.mode_set.poll():\n" +
|
|
3
|
+
" bpy.ops.object.mode_set(mode='OBJECT')\n";
|
|
4
|
+
export const objectCatalogTools = [
|
|
5
|
+
{
|
|
6
|
+
name: "blender_rename_object",
|
|
7
|
+
title: "Rename Object",
|
|
8
|
+
description: "Rename a single object.",
|
|
9
|
+
readOnly: false,
|
|
10
|
+
params: [
|
|
11
|
+
{ name: "objectName", type: "string" },
|
|
12
|
+
{ name: "newName", type: "string" },
|
|
13
|
+
],
|
|
14
|
+
build: (p) => "import bpy\n" +
|
|
15
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
16
|
+
`new_name = ${JSON.stringify(p.newName)}\n` +
|
|
17
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
18
|
+
"if obj is None:\n" +
|
|
19
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
20
|
+
"obj.name = new_name\n" +
|
|
21
|
+
"result = {'old_name': object_name, 'new_name': obj.name}\n",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "blender_rename_objects",
|
|
25
|
+
title: "Rename Objects",
|
|
26
|
+
description: "Rename multiple objects, optionally replacing a substring.",
|
|
27
|
+
readOnly: false,
|
|
28
|
+
params: [
|
|
29
|
+
{ name: "objectNames", type: "stringArray" },
|
|
30
|
+
{ name: "newName", type: "string", optional: true },
|
|
31
|
+
{ name: "find", type: "string", optional: true },
|
|
32
|
+
{ name: "replace", type: "string", optional: true },
|
|
33
|
+
{ name: "prefix", type: "string", optional: true },
|
|
34
|
+
{ name: "pattern", type: "string", optional: true, description: "Wildcard to select objects to rename." },
|
|
35
|
+
],
|
|
36
|
+
build: (p) => "import bpy, fnmatch\n" +
|
|
37
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
38
|
+
`new_name = ${JSON.stringify(p.newName ?? "")}\n` +
|
|
39
|
+
`find = ${JSON.stringify(p.find ?? "")}\n` +
|
|
40
|
+
`replace = ${JSON.stringify(p.replace ?? "")}\n` +
|
|
41
|
+
`prefix = ${JSON.stringify(p.prefix ?? "")}\n` +
|
|
42
|
+
`pattern = ${JSON.stringify(p.pattern ?? "")}\n` +
|
|
43
|
+
"targets = []\n" +
|
|
44
|
+
"for name in names:\n" +
|
|
45
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
46
|
+
" if obj is not None:\n" +
|
|
47
|
+
" targets.append(obj)\n" +
|
|
48
|
+
"if pattern and not targets:\n" +
|
|
49
|
+
" for obj in bpy.data.objects:\n" +
|
|
50
|
+
" if fnmatch.fnmatch(obj.name, pattern):\n" +
|
|
51
|
+
" targets.append(obj)\n" +
|
|
52
|
+
"renamed = []\n" +
|
|
53
|
+
"for i, obj in enumerate(targets):\n" +
|
|
54
|
+
" if new_name:\n" +
|
|
55
|
+
" base = new_name if len(targets) == 1 else f'{new_name}.{i:03d}'\n" +
|
|
56
|
+
" else:\n" +
|
|
57
|
+
" base = obj.name\n" +
|
|
58
|
+
" if find and replace:\n" +
|
|
59
|
+
" base = base.replace(find, replace)\n" +
|
|
60
|
+
" if prefix:\n" +
|
|
61
|
+
" base = prefix + base\n" +
|
|
62
|
+
" obj.name = base\n" +
|
|
63
|
+
" renamed.append(base)\n" +
|
|
64
|
+
"result = {'renamed': renamed, 'count': len(renamed)}\n",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "blender_delete_object",
|
|
68
|
+
title: "Delete Object",
|
|
69
|
+
description: "Delete a single object.",
|
|
70
|
+
readOnly: false,
|
|
71
|
+
params: [{ name: "objectName", type: "string" }],
|
|
72
|
+
build: (p) => "import bpy\n" +
|
|
73
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
74
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
75
|
+
"if obj is None:\n" +
|
|
76
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
77
|
+
"bpy.ops.object.mode_set(mode='OBJECT') if bpy.ops.object.mode_set.poll() else None\n" +
|
|
78
|
+
"name = obj.name\n" +
|
|
79
|
+
"bpy.data.objects.remove(obj, do_unlink=True)\n" +
|
|
80
|
+
"result = {'deleted': name}\n",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "blender_delete_objects",
|
|
84
|
+
title: "Delete Objects",
|
|
85
|
+
description: "Delete multiple objects by name.",
|
|
86
|
+
readOnly: false,
|
|
87
|
+
params: [{ name: "objectNames", type: "stringArray" }],
|
|
88
|
+
build: (p) => "import bpy\n" +
|
|
89
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
90
|
+
"bpy.ops.object.mode_set(mode='OBJECT') if bpy.ops.object.mode_set.poll() else None\n" +
|
|
91
|
+
"deleted = []\n" +
|
|
92
|
+
"for name in names:\n" +
|
|
93
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
94
|
+
" if obj:\n" +
|
|
95
|
+
" deleted.append(obj.name)\n" +
|
|
96
|
+
" bpy.data.objects.remove(obj, do_unlink=True)\n" +
|
|
97
|
+
"result = {'deleted': deleted, 'count': len(deleted)}\n",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "blender_make_single_user",
|
|
101
|
+
title: "Make Single User",
|
|
102
|
+
description: "Make selected objects single-user (duplicate their linked data).",
|
|
103
|
+
readOnly: false,
|
|
104
|
+
params: [
|
|
105
|
+
{ name: "objectNames", type: "stringArray", optional: true },
|
|
106
|
+
{ name: "dataOnly", type: "boolean", optional: true, default: false },
|
|
107
|
+
],
|
|
108
|
+
build: (p) => objectPrelude +
|
|
109
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
110
|
+
`data_only = ${p.dataOnly === true ? "True" : "False"}\n` +
|
|
111
|
+
"if names:\n" +
|
|
112
|
+
" bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
113
|
+
" for name in names:\n" +
|
|
114
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
115
|
+
" if obj:\n" +
|
|
116
|
+
" obj.select_set(True)\n" +
|
|
117
|
+
" if bpy.context.view_layer.objects.active is None:\n" +
|
|
118
|
+
" bpy.context.view_layer.objects.active = obj\n" +
|
|
119
|
+
"if data_only:\n" +
|
|
120
|
+
" bpy.ops.object.make_single_user(object=True, obdata=True, material=True, animation=True)\n" +
|
|
121
|
+
"else:\n" +
|
|
122
|
+
" bpy.ops.object.make_single_user(object=True, obdata=True, material=True, animation=True)\n" +
|
|
123
|
+
"result = {'made_single_user': True}\n",
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "blender_make_instances",
|
|
127
|
+
title: "Make Instances",
|
|
128
|
+
description: "Convert selected objects to instances sharing mesh data with a parent.",
|
|
129
|
+
readOnly: false,
|
|
130
|
+
params: [{ name: "objectNames", type: "stringArray", optional: true }],
|
|
131
|
+
build: (p) => objectPrelude +
|
|
132
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
133
|
+
"if names:\n" +
|
|
134
|
+
" bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
135
|
+
" for name in names:\n" +
|
|
136
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
137
|
+
" if obj:\n" +
|
|
138
|
+
" obj.select_set(True)\n" +
|
|
139
|
+
"bpy.ops.object.make_links_data(type='OBDATA')\n" +
|
|
140
|
+
"result = {'made_instances': True, 'note': 'Linked mesh data; select target object first for source.'}\n",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "blender_convert_duplicates_to_instances",
|
|
144
|
+
title: "Convert Duplicates to Instances",
|
|
145
|
+
description: "Convert duplicate mesh copies to shared instances to save memory.",
|
|
146
|
+
readOnly: false,
|
|
147
|
+
params: [{ name: "objectNames", type: "stringArray", optional: true }],
|
|
148
|
+
build: (p) => "import bpy\n" +
|
|
149
|
+
"bpy.ops.object.mode_set(mode='OBJECT') if bpy.ops.object.mode_set.poll() else None\n" +
|
|
150
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
151
|
+
"objs = []\n" +
|
|
152
|
+
"if names:\n" +
|
|
153
|
+
" for name in names:\n" +
|
|
154
|
+
" o = bpy.data.objects.get(name)\n" +
|
|
155
|
+
" if o:\n" +
|
|
156
|
+
" objs.append(o)\n" +
|
|
157
|
+
"else:\n" +
|
|
158
|
+
" objs = list(bpy.context.scene.objects)\n" +
|
|
159
|
+
"mesh_by_fingerprint = {}\n" +
|
|
160
|
+
"converted = 0\n" +
|
|
161
|
+
"for obj in objs:\n" +
|
|
162
|
+
" if obj.type != 'MESH' or not obj.data:\n" +
|
|
163
|
+
" continue\n" +
|
|
164
|
+
" fp = (len(obj.data.vertices), len(obj.data.polygons))\n" +
|
|
165
|
+
" if fp not in mesh_by_fingerprint:\n" +
|
|
166
|
+
" mesh_by_fingerprint[fp] = obj.data.name\n" +
|
|
167
|
+
" else:\n" +
|
|
168
|
+
" src = bpy.data.meshes.get(mesh_by_fingerprint[fp])\n" +
|
|
169
|
+
" if src is not None:\n" +
|
|
170
|
+
" obj.data = src\n" +
|
|
171
|
+
" converted += 1\n" +
|
|
172
|
+
"result = {'converted': converted, 'note': 'Fingerprint-based mesh sharing (point-count heuristic).'}\n",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "blender_separate_object",
|
|
176
|
+
title: "Separate Object",
|
|
177
|
+
description: "Separate selected faces/loose parts into new objects.",
|
|
178
|
+
readOnly: false,
|
|
179
|
+
params: [
|
|
180
|
+
{ name: "objectName", type: "string" },
|
|
181
|
+
{ name: "separateType", type: "string", optional: true, default: "SELECTED", enumValues: ["SELECTED", "MATERIAL", "LOOSE", "BY_MATERIAL"] },
|
|
182
|
+
],
|
|
183
|
+
build: (p) => "import bpy\n" +
|
|
184
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
185
|
+
`sep_type = ${JSON.stringify((p.separateType ?? "SELECTED").upper().replace("_", " ").replace(" ", "_"))}\n` +
|
|
186
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
187
|
+
"if obj is None or obj.type != 'MESH':\n" +
|
|
188
|
+
" raise RuntimeError('Mesh object not found: ' + object_name)\n" +
|
|
189
|
+
"bpy.context.view_layer.objects.active = obj\n" +
|
|
190
|
+
"obj.select_set(True)\n" +
|
|
191
|
+
"if bpy.context.object.mode != 'EDIT':\n" +
|
|
192
|
+
" bpy.ops.object.mode_set(mode='EDIT')\n" +
|
|
193
|
+
"bpy.ops.mesh.separate(type=sep_type)\n" +
|
|
194
|
+
"bpy.ops.object.mode_set(mode='OBJECT') if bpy.ops.object.mode_set.poll() else None\n" +
|
|
195
|
+
"result = {'separated': True, 'type': sep_type}\n",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: "blender_set_parent_inverse",
|
|
199
|
+
title: "Set Parent Inverse",
|
|
200
|
+
description: "Set the parent inverse matrix of selected objects.",
|
|
201
|
+
readOnly: false,
|
|
202
|
+
params: [{ name: "objectNames", type: "stringArray", optional: true }],
|
|
203
|
+
build: (p) => objectPrelude +
|
|
204
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
205
|
+
"bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
206
|
+
"for name in (names or []):\n" +
|
|
207
|
+
" o = bpy.data.objects.get(name)\n" +
|
|
208
|
+
" if o:\n" +
|
|
209
|
+
" o.select_set(True)\n" +
|
|
210
|
+
" if bpy.context.view_layer.objects.active is None:\n" +
|
|
211
|
+
" bpy.context.view_layer.objects.active = o\n" +
|
|
212
|
+
"bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)\n" +
|
|
213
|
+
"result = {'set_parent_inverse': True}\n",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: "blender_link_to_collection",
|
|
217
|
+
title: "Link to Collection",
|
|
218
|
+
description: "Link objects to a collection without removing them from others.",
|
|
219
|
+
readOnly: false,
|
|
220
|
+
params: [
|
|
221
|
+
{ name: "objectNames", type: "stringArray" },
|
|
222
|
+
{ name: "collectionName", type: "string" },
|
|
223
|
+
],
|
|
224
|
+
build: (p) => "import bpy\n" +
|
|
225
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
226
|
+
`collection_name = ${JSON.stringify(p.collectionName)}\n` +
|
|
227
|
+
"coll = bpy.data.collections.get(collection_name) or bpy.data.collections.new(collection_name)\n" +
|
|
228
|
+
"if coll.name not in bpy.context.scene.collection.children:\n" +
|
|
229
|
+
" try:\n" +
|
|
230
|
+
" bpy.context.scene.collection.children.link(coll)\n" +
|
|
231
|
+
" except RuntimeError:\n" +
|
|
232
|
+
" pass\n" +
|
|
233
|
+
"linked = []\n" +
|
|
234
|
+
"for name in names:\n" +
|
|
235
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
236
|
+
" if obj:\n" +
|
|
237
|
+
" if obj.name not in coll.objects:\n" +
|
|
238
|
+
" coll.objects.link(obj)\n" +
|
|
239
|
+
" linked.append(obj.name)\n" +
|
|
240
|
+
"result = {'collection': coll.name, 'linked': linked, 'count': len(linked)}\n",
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
name: "blender_unlink_from_collection",
|
|
244
|
+
title: "Unlink from Collection",
|
|
245
|
+
description: "Remove objects from a collection.",
|
|
246
|
+
readOnly: false,
|
|
247
|
+
params: [
|
|
248
|
+
{ name: "objectNames", type: "stringArray" },
|
|
249
|
+
{ name: "collectionName", type: "string" },
|
|
250
|
+
],
|
|
251
|
+
build: (p) => "import bpy\n" +
|
|
252
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
253
|
+
`collection_name = ${JSON.stringify(p.collectionName)}\n` +
|
|
254
|
+
"coll = bpy.data.collections.get(collection_name)\n" +
|
|
255
|
+
"if coll is None:\n" +
|
|
256
|
+
" raise RuntimeError('Collection not found: ' + collection_name)\n" +
|
|
257
|
+
"unlinked = []\n" +
|
|
258
|
+
"for name in names:\n" +
|
|
259
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
260
|
+
" if obj and obj.name in coll.objects:\n" +
|
|
261
|
+
" coll.objects.unlink(obj)\n" +
|
|
262
|
+
" unlinked.append(obj.name)\n" +
|
|
263
|
+
"result = {'collection': coll.name, 'unlinked': unlinked, 'count': len(unlinked)}\n",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: "blender_hide_object",
|
|
267
|
+
title: "Hide Object",
|
|
268
|
+
description: "Hide a single object in the viewport.",
|
|
269
|
+
readOnly: false,
|
|
270
|
+
params: [{ name: "objectName", type: "string" }],
|
|
271
|
+
build: (p) => "import bpy\n" +
|
|
272
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
273
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
274
|
+
"if obj is None:\n" +
|
|
275
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
276
|
+
"obj.hide_set(True)\n" +
|
|
277
|
+
"result = {'hidden': obj.name}\n",
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "blender_unhide_object",
|
|
281
|
+
title: "Unhide Object",
|
|
282
|
+
description: "Unhide a single object in the viewport.",
|
|
283
|
+
readOnly: false,
|
|
284
|
+
params: [{ name: "objectName", type: "string" }],
|
|
285
|
+
build: (p) => "import bpy\n" +
|
|
286
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
287
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
288
|
+
"if obj is None:\n" +
|
|
289
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
290
|
+
"obj.hide_set(False)\n" +
|
|
291
|
+
"obj.hide_select = False\n" +
|
|
292
|
+
"result = {'name': obj.name, 'hidden': False}\n",
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "blender_set_object_visibility",
|
|
296
|
+
title: "Set Object Visibility",
|
|
297
|
+
description: "Set viewport, render, and select visibility of objects.",
|
|
298
|
+
readOnly: false,
|
|
299
|
+
params: [
|
|
300
|
+
{ name: "objectNames", type: "stringArray" },
|
|
301
|
+
{ name: "visible", type: "boolean", optional: true, default: true },
|
|
302
|
+
{ name: "hideRender", type: "boolean", optional: true },
|
|
303
|
+
],
|
|
304
|
+
build: (p) => "import bpy\n" +
|
|
305
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
306
|
+
`visible = ${p.visible === false ? "False" : "True"}\n` +
|
|
307
|
+
`hide_render = ${p.hideRender === true ? "True" : p.hideRender === false ? "False" : "None"}\n` +
|
|
308
|
+
"updated = []\n" +
|
|
309
|
+
"for name in names:\n" +
|
|
310
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
311
|
+
" if obj:\n" +
|
|
312
|
+
" obj.hide_set(not visible)\n" +
|
|
313
|
+
" obj.hide_select = not visible\n" +
|
|
314
|
+
" if hide_render is not None:\n" +
|
|
315
|
+
" obj.hide_render = hide_render\n" +
|
|
316
|
+
" updated.append(obj.name)\n" +
|
|
317
|
+
"result = {'updated': updated, 'visible': visible}\n",
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: "blender_set_render_visibility",
|
|
321
|
+
title: "Set Render Visibility",
|
|
322
|
+
description: "Set render visibility (include/exclude from render) of objects.",
|
|
323
|
+
readOnly: false,
|
|
324
|
+
params: [
|
|
325
|
+
{ name: "objectNames", type: "stringArray" },
|
|
326
|
+
{ name: "visible", type: "boolean", optional: true, default: true },
|
|
327
|
+
],
|
|
328
|
+
build: (p) => "import bpy\n" +
|
|
329
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
330
|
+
`visible = ${p.visible === false ? "False" : "True"}\n` +
|
|
331
|
+
"updated = []\n" +
|
|
332
|
+
"for name in names:\n" +
|
|
333
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
334
|
+
" if obj:\n" +
|
|
335
|
+
" obj.hide_render = not visible\n" +
|
|
336
|
+
" updated.append(obj.name)\n" +
|
|
337
|
+
"result = {'updated': updated, 'render_visible': visible}\n",
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: "blender_set_viewport_visibility",
|
|
341
|
+
title: "Set Viewport Visibility",
|
|
342
|
+
description: "Set viewport visibility of objects.",
|
|
343
|
+
readOnly: false,
|
|
344
|
+
params: [
|
|
345
|
+
{ name: "objectNames", type: "stringArray" },
|
|
346
|
+
{ name: "visible", type: "boolean", optional: true, default: true },
|
|
347
|
+
],
|
|
348
|
+
build: (p) => "import bpy\n" +
|
|
349
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
350
|
+
`visible = ${p.visible === false ? "False" : "True"}\n` +
|
|
351
|
+
"updated = []\n" +
|
|
352
|
+
"for name in names:\n" +
|
|
353
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
354
|
+
" if obj:\n" +
|
|
355
|
+
" obj.hide_set(not visible)\n" +
|
|
356
|
+
" updated.append(obj.name)\n" +
|
|
357
|
+
"result = {'updated': updated, 'viewport_visible': visible}\n",
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
name: "blender_set_object_display_type",
|
|
361
|
+
title: "Set Object Display Type",
|
|
362
|
+
description: "Set the display type of empty objects in the viewport.",
|
|
363
|
+
readOnly: false,
|
|
364
|
+
params: [
|
|
365
|
+
{ name: "objectName", type: "string" },
|
|
366
|
+
{ name: "displayType", type: "string", optional: true, default: "PLAIN_AXES", enumValues: ["PLAIN_AXES", "ARROWS", "SINGLE_ARROW", "CIRCLE", "CUBE", "SPHERE", "CONE", "IMAGE"] },
|
|
367
|
+
],
|
|
368
|
+
build: (p) => "import bpy\n" +
|
|
369
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
370
|
+
`display_type = ${JSON.stringify((p.displayType ?? "PLAIN_AXES").upper())}\n` +
|
|
371
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
372
|
+
"if obj is None:\n" +
|
|
373
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
374
|
+
"if obj.type != 'EMPTY':\n" +
|
|
375
|
+
" raise RuntimeError('Only EMPTY objects have display types')\n" +
|
|
376
|
+
"obj.empty_display_type = display_type\n" +
|
|
377
|
+
"result = {'object': obj.name, 'display_type': display_type}\n",
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "blender_set_object_color",
|
|
381
|
+
title: "Set Object Color",
|
|
382
|
+
description: "Set the viewport color override of an object.",
|
|
383
|
+
readOnly: false,
|
|
384
|
+
params: [
|
|
385
|
+
{ name: "objectName", type: "string" },
|
|
386
|
+
{ name: "color", type: "numberArray", optional: true, default: [1, 1, 1, 1] },
|
|
387
|
+
],
|
|
388
|
+
build: (p) => "import bpy\n" +
|
|
389
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
390
|
+
`color = ${JSON.stringify(p.color ?? [1, 1, 1, 1])}\n` +
|
|
391
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
392
|
+
"if obj is None:\n" +
|
|
393
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
394
|
+
"obj.color = (color[0], color[1], color[2], color[3] if len(color) > 3 else 1.0)\n" +
|
|
395
|
+
"result = {'object': obj.name, 'color': list(obj.color)}\n",
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: "blender_set_origin_to_geometry",
|
|
399
|
+
title: "Set Origin to Geometry",
|
|
400
|
+
description: "Move object origin to the center of its geometry.",
|
|
401
|
+
readOnly: false,
|
|
402
|
+
params: [{ name: "objectNames", type: "stringArray" }],
|
|
403
|
+
build: (p) => objectPrelude +
|
|
404
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
405
|
+
"bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
406
|
+
"for name in names:\n" +
|
|
407
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
408
|
+
" if obj:\n" +
|
|
409
|
+
" obj.select_set(True)\n" +
|
|
410
|
+
" bpy.context.view_layer.objects.active = obj\n" +
|
|
411
|
+
" bpy.ops.object.origin_set(type='ORIGIN_GEOMETRY', center='MEDIAN')\n" +
|
|
412
|
+
"result = {'origins_set': len(names)}\n",
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: "blender_set_origin_to_cursor",
|
|
416
|
+
title: "Set Origin to Cursor",
|
|
417
|
+
description: "Move object origin to the 3D cursor.",
|
|
418
|
+
readOnly: false,
|
|
419
|
+
params: [{ name: "objectNames", type: "stringArray" }],
|
|
420
|
+
build: (p) => objectPrelude +
|
|
421
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
422
|
+
"for name in names:\n" +
|
|
423
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
424
|
+
" if obj:\n" +
|
|
425
|
+
" bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
426
|
+
" obj.select_set(True)\n" +
|
|
427
|
+
" bpy.context.view_layer.objects.active = obj\n" +
|
|
428
|
+
" bpy.ops.object.origin_set(type='ORIGIN_CURSOR', center='MEDIAN')\n" +
|
|
429
|
+
"result = {'origins_set': len(names)}\n",
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
name: "blender_freeze_transforms",
|
|
433
|
+
title: "Freeze Transforms",
|
|
434
|
+
description: "Apply all transforms to selected objects.",
|
|
435
|
+
readOnly: false,
|
|
436
|
+
params: [{ name: "objectNames", type: "stringArray" }],
|
|
437
|
+
build: (p) => objectPrelude +
|
|
438
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
439
|
+
"bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
440
|
+
"for name in names:\n" +
|
|
441
|
+
" obj = bpy.data.objects.get(name)\n" +
|
|
442
|
+
" if obj:\n" +
|
|
443
|
+
" obj.select_set(True)\n" +
|
|
444
|
+
" bpy.context.view_layer.objects.active = obj\n" +
|
|
445
|
+
" bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)\n" +
|
|
446
|
+
" obj.select_set(False)\n" +
|
|
447
|
+
"result = {'frozen': len(names)}\n",
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
name: "blender_set_custom_property",
|
|
451
|
+
title: "Set Custom Property",
|
|
452
|
+
description: "Set a custom property on an object.",
|
|
453
|
+
readOnly: false,
|
|
454
|
+
params: [
|
|
455
|
+
{ name: "objectName", type: "string" },
|
|
456
|
+
{ name: "propertyName", type: "string" },
|
|
457
|
+
{ name: "propertyValue", type: "string", optional: true },
|
|
458
|
+
{ name: "valueType", type: "string", optional: true, default: "auto", enumValues: ["auto", "string", "float", "int", "bool"] },
|
|
459
|
+
],
|
|
460
|
+
build: (p) => "import bpy\n" +
|
|
461
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
462
|
+
`prop_name = ${JSON.stringify(p.propertyName)}\n` +
|
|
463
|
+
`prop_value = ${JSON.stringify(p.propertyValue ?? "")}\n` +
|
|
464
|
+
`value_type = ${JSON.stringify((p.valueType ?? "auto").lower())}\n` +
|
|
465
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
466
|
+
"if obj is None:\n" +
|
|
467
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
468
|
+
"if value_type == 'float':\n" +
|
|
469
|
+
" val = float(prop_value)\n" +
|
|
470
|
+
"elif value_type == 'int':\n" +
|
|
471
|
+
" val = int(prop_value)\n" +
|
|
472
|
+
"elif value_type == 'bool':\n" +
|
|
473
|
+
" val = str(prop_value).lower() in {'1', 'true', 'yes'}\n" +
|
|
474
|
+
"else:\n" +
|
|
475
|
+
" try:\n" +
|
|
476
|
+
" val = float(prop_value)\n" +
|
|
477
|
+
" except ValueError:\n" +
|
|
478
|
+
" val = prop_value\n" +
|
|
479
|
+
"obj[prop_name] = val\n" +
|
|
480
|
+
"result = {'object': obj.name, 'property': prop_name, 'value': obj[prop_name]}\n",
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
name: "blender_remove_custom_property",
|
|
484
|
+
title: "Remove Custom Property",
|
|
485
|
+
description: "Remove a custom property from an object.",
|
|
486
|
+
readOnly: false,
|
|
487
|
+
params: [
|
|
488
|
+
{ name: "objectName", type: "string" },
|
|
489
|
+
{ name: "propertyName", type: "string" },
|
|
490
|
+
],
|
|
491
|
+
build: (p) => "import bpy\n" +
|
|
492
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
493
|
+
`prop_name = ${JSON.stringify(p.propertyName)}\n` +
|
|
494
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
495
|
+
"if obj is None:\n" +
|
|
496
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
497
|
+
"if prop_name in obj:\n" +
|
|
498
|
+
" del obj[prop_name]\n" +
|
|
499
|
+
" removed = True\n" +
|
|
500
|
+
"else:\n" +
|
|
501
|
+
" removed = False\n" +
|
|
502
|
+
"result = {'object': obj.name, 'property': prop_name, 'removed': removed}\n",
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
name: "blender_move_object",
|
|
506
|
+
title: "Move Object",
|
|
507
|
+
description: "Move an object by a relative offset.",
|
|
508
|
+
readOnly: false,
|
|
509
|
+
params: [
|
|
510
|
+
{ name: "objectName", type: "string" },
|
|
511
|
+
{ name: "delta", type: "numberArray", default: [0, 0, 0] },
|
|
512
|
+
],
|
|
513
|
+
build: (p) => "import bpy\n" +
|
|
514
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
515
|
+
`delta = ${JSON.stringify(p.delta ?? [0, 0, 0])}\n` +
|
|
516
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
517
|
+
"if obj is None:\n" +
|
|
518
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
519
|
+
"obj.location += delta\n" +
|
|
520
|
+
"result = {'object': obj.name, 'location': [round(v, 4) for v in obj.location]}\n",
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
name: "blender_rotate_object",
|
|
524
|
+
title: "Rotate Object",
|
|
525
|
+
description: "Rotate an object by a delta Euler rotation (degrees).",
|
|
526
|
+
readOnly: false,
|
|
527
|
+
params: [
|
|
528
|
+
{ name: "objectName", type: "string" },
|
|
529
|
+
{ name: "rotation", type: "numberArray", optional: true, default: [0, 0, 0] },
|
|
530
|
+
{ name: "order", type: "string", optional: true, default: "XYZ" },
|
|
531
|
+
],
|
|
532
|
+
build: (p) => "import bpy\n" +
|
|
533
|
+
"import math\n" +
|
|
534
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
535
|
+
`rotation = ${JSON.stringify(p.rotation ?? [0, 0, 0])}\n` +
|
|
536
|
+
`order = ${JSON.stringify((p.order ?? "XYZ").upper())}\n` +
|
|
537
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
538
|
+
"if obj is None:\n" +
|
|
539
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
540
|
+
"from mathutils import Euler\n" +
|
|
541
|
+
"delta = Euler((rotation[0] * math.pi / 180, rotation[1] * math.pi / 180, rotation[2] * math.pi / 180), order)\n" +
|
|
542
|
+
"obj.rotation_euler = ((obj.rotation_euler.to_matrix() @ delta.to_matrix()).to_euler(order))\n" +
|
|
543
|
+
"result = {'object': obj.name, 'rotation_euler': [round(v, 4) for v in obj.rotation_euler]}\n",
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
name: "blender_scale_object",
|
|
547
|
+
title: "Scale Object",
|
|
548
|
+
description: "Scale an object by a factor.",
|
|
549
|
+
readOnly: false,
|
|
550
|
+
params: [
|
|
551
|
+
{ name: "objectName", type: "string" },
|
|
552
|
+
{ name: "scale", type: "numberArray", optional: true, default: [1, 1, 1] },
|
|
553
|
+
{ name: "uniform", type: "number", optional: true },
|
|
554
|
+
],
|
|
555
|
+
build: (p) => "import bpy\n" +
|
|
556
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
557
|
+
`scale = ${JSON.stringify(p.scale ?? null)}\n` +
|
|
558
|
+
`uniform = ${JSON.stringify(p.uniform ?? null)}\n` +
|
|
559
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
560
|
+
"if obj is None:\n" +
|
|
561
|
+
" raise RuntimeError('Object not found: ' + object_name)\n" +
|
|
562
|
+
"if uniform is not None:\n" +
|
|
563
|
+
" obj.scale = (uniform, uniform, uniform)\n" +
|
|
564
|
+
"else:\n" +
|
|
565
|
+
" obj.scale = scale\n" +
|
|
566
|
+
"result = {'object': obj.name, 'scale': [round(v, 4) for v in obj.scale]}\n",
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: "blender_align_objects",
|
|
570
|
+
title: "Align Objects",
|
|
571
|
+
description: "Align selected objects by a chosen axis to themselves or the active object.",
|
|
572
|
+
readOnly: false,
|
|
573
|
+
params: [
|
|
574
|
+
{ name: "objectNames", type: "stringArray" },
|
|
575
|
+
{ name: "align", type: "string", optional: true, default: "MAX", enumValues: ["MIN", "MAX", "CENTER", "ACTIVE"] },
|
|
576
|
+
{ name: "axis", type: "string", optional: true, default: "X", enumValues: ["X", "Y", "Z"] },
|
|
577
|
+
],
|
|
578
|
+
build: (p) => "import bpy\n" +
|
|
579
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
580
|
+
`align = ${JSON.stringify((p.align ?? "MAX").upper())}\n` +
|
|
581
|
+
`axis = ${JSON.stringify((p.axis ?? "X").upper())}\n` +
|
|
582
|
+
"bpy.ops.object.select_all(action='DESELECT')\n" +
|
|
583
|
+
"objs = []\n" +
|
|
584
|
+
"for name in names:\n" +
|
|
585
|
+
" o = bpy.data.objects.get(name)\n" +
|
|
586
|
+
" if o:\n" +
|
|
587
|
+
" o.select_set(True)\n" +
|
|
588
|
+
" objs.append(o)\n" +
|
|
589
|
+
"if len(objs) < 1:\n" +
|
|
590
|
+
" raise RuntimeError('Need objects to align')\n" +
|
|
591
|
+
"bpy.ops.object.align(align_axis={axis: align}, relative_to='OPTICS')\n" +
|
|
592
|
+
"result = {'aligned': len(objs), 'axis': axis, 'align': align}\n",
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
name: "blender_distribute_objects",
|
|
596
|
+
title: "Distribute Objects",
|
|
597
|
+
description: "Distribute selected objects with spacing along an axis.",
|
|
598
|
+
readOnly: false,
|
|
599
|
+
params: [
|
|
600
|
+
{ name: "objectNames", type: "stringArray" },
|
|
601
|
+
{ name: "axis", type: "string", optional: true, default: "X", enumValues: ["X", "Y", "Z"] },
|
|
602
|
+
{ name: "spacing", type: "number", optional: true, default: 1 },
|
|
603
|
+
],
|
|
604
|
+
build: (p) => "import bpy\n" +
|
|
605
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
606
|
+
`axis = ${JSON.stringify((p.axis ?? "X").upper())}\n` +
|
|
607
|
+
`spacing = ${JSON.stringify(p.spacing ?? 1)}\n` +
|
|
608
|
+
"axis_index = {'X': 0, 'Y': 1, 'Z': 2}[axis]\n" +
|
|
609
|
+
"objs = []\n" +
|
|
610
|
+
"for name in names:\n" +
|
|
611
|
+
" o = bpy.data.objects.get(name)\n" +
|
|
612
|
+
" if o:\n" +
|
|
613
|
+
" objs.append(o)\n" +
|
|
614
|
+
"if len(objs) < 2:\n" +
|
|
615
|
+
" result = {'distributed': 0, 'note': 'Need at least two objects.'}\n" +
|
|
616
|
+
"else:\n" +
|
|
617
|
+
" for i, o in enumerate(objs):\n" +
|
|
618
|
+
" v = o.location.copy()\n" +
|
|
619
|
+
" v[axis_index] = i * spacing\n" +
|
|
620
|
+
" o.location = v\n" +
|
|
621
|
+
" result = {'distributed': len(objs), 'axis': axis, 'spacing': spacing}\n",
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
name: "blender_randomize_transforms",
|
|
625
|
+
title: "Randomize Transforms",
|
|
626
|
+
description: "Randomize location, rotation, and/or scale of selected objects within a range.",
|
|
627
|
+
readOnly: false,
|
|
628
|
+
params: [
|
|
629
|
+
{ name: "objectNames", type: "stringArray", optional: true },
|
|
630
|
+
{ name: "amount", type: "number", optional: true, default: 0.5 },
|
|
631
|
+
{ name: "loc", type: "boolean", optional: true, default: true },
|
|
632
|
+
{ name: "rot", type: "boolean", optional: true, default: false },
|
|
633
|
+
{ name: "scale", type: "boolean", optional: true, default: false },
|
|
634
|
+
],
|
|
635
|
+
build: (p) => "import bpy, random\n" +
|
|
636
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
637
|
+
`amount = ${JSON.stringify(p.amount ?? 0.5)}\n` +
|
|
638
|
+
`use_loc = ${p.loc === false ? "False" : "True"}\n` +
|
|
639
|
+
`use_rot = ${p.rot === true ? "True" : "False"}\n` +
|
|
640
|
+
`use_scale = ${p.scale === true ? "True" : "False"}\n` +
|
|
641
|
+
"objs = []\n" +
|
|
642
|
+
"if names:\n" +
|
|
643
|
+
" for name in names:\n" +
|
|
644
|
+
" o = bpy.data.objects.get(name)\n" +
|
|
645
|
+
" if o:\n" +
|
|
646
|
+
" objs.append(o)\n" +
|
|
647
|
+
"else:\n" +
|
|
648
|
+
" objs = list(bpy.context.selected_objects)\n" +
|
|
649
|
+
"for o in objs:\n" +
|
|
650
|
+
" if use_loc:\n" +
|
|
651
|
+
" o.location += (random.uniform(-amount, amount), random.uniform(-amount, amount), random.uniform(-amount, amount))\n" +
|
|
652
|
+
" if use_scale:\n" +
|
|
653
|
+
" s = random.uniform(max(0.1, 1 - amount), 1 + amount)\n" +
|
|
654
|
+
" o.scale = (s, s, s)\n" +
|
|
655
|
+
"result = {'randomized': len(objs)}\n",
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "blender_snap_objects_to_grid",
|
|
659
|
+
title: "Snap Objects to Grid",
|
|
660
|
+
description: "Snap object locations to a grid.",
|
|
661
|
+
readOnly: false,
|
|
662
|
+
params: [
|
|
663
|
+
{ name: "objectNames", type: "stringArray", optional: true },
|
|
664
|
+
{ name: "gridSize", type: "number", optional: true, default: 0.1 },
|
|
665
|
+
],
|
|
666
|
+
build: (p) => "import bpy\n" +
|
|
667
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
668
|
+
`grid_size = ${JSON.stringify(p.gridSize ?? 0.1)}\n` +
|
|
669
|
+
"objs = [bpy.data.objects.get(n) for n in (names or []) if bpy.data.objects.get(n)]\n" +
|
|
670
|
+
"if not objs:\n" +
|
|
671
|
+
" objs = list(bpy.context.selected_objects)\n" +
|
|
672
|
+
"for o in objs:\n" +
|
|
673
|
+
" o.location.x = round(o.location.x / grid_size) * grid_size\n" +
|
|
674
|
+
" o.location.y = round(o.location.y / grid_size) * grid_size\n" +
|
|
675
|
+
" o.location.z = round(o.location.z / grid_size) * grid_size\n" +
|
|
676
|
+
"result = {'snapped': len(objs), 'grid_size': grid_size}\n",
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
name: "blender_snap_objects_to_surface",
|
|
680
|
+
title: "Snap Objects to Surface",
|
|
681
|
+
description: "Snap objects down along -Z to the highest ray-hit surface below them.",
|
|
682
|
+
readOnly: false,
|
|
683
|
+
params: [
|
|
684
|
+
{ name: "objectNames", type: "stringArray", optional: true },
|
|
685
|
+
{ name: "targetObject", type: "string", optional: true },
|
|
686
|
+
],
|
|
687
|
+
build: (p) => "import bpy\n" +
|
|
688
|
+
"from mathutils import Vector\n" +
|
|
689
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
690
|
+
`target_name = ${JSON.stringify(p.targetObject ?? "")}\n` +
|
|
691
|
+
"objs = [bpy.data.objects.get(n) for n in (names or []) if bpy.data.objects.get(n)]\n" +
|
|
692
|
+
"if not objs:\n" +
|
|
693
|
+
" objs = list(bpy.context.selected_objects)\n" +
|
|
694
|
+
"if target_name:\n" +
|
|
695
|
+
" target = bpy.data.objects.get(target_name)\n" +
|
|
696
|
+
" depsgraph = bpy.context.evaluated_depsgraph_get()\n" +
|
|
697
|
+
" target_eval = target.evaluated_get(depsgraph) if target else None\n" +
|
|
698
|
+
"else:\n" +
|
|
699
|
+
" target_eval = None\n" +
|
|
700
|
+
"snapped = 0\n" +
|
|
701
|
+
"for o in objs:\n" +
|
|
702
|
+
" source = o if target_eval is None else target_eval\n" +
|
|
703
|
+
" if o.type == 'MESH' and hasattr(o.data, 'polygons'):\n" +
|
|
704
|
+
" direction = Vector((0, 0, -1))\n" +
|
|
705
|
+
" origin = o.location + Vector((0, 0, 100))\n" +
|
|
706
|
+
" hit, loc, normal, index = source.ray_cast(origin, direction)\n" +
|
|
707
|
+
" if hit:\n" +
|
|
708
|
+
" o.location.z = loc.z\n" +
|
|
709
|
+
" snapped += 1\n" +
|
|
710
|
+
"result = {'snapped': snapped}\n",
|
|
711
|
+
},
|
|
712
|
+
{
|
|
713
|
+
name: "blender_set_pivot_point",
|
|
714
|
+
title: "Set Pivot Point",
|
|
715
|
+
description: "Set the transformation pivot point.",
|
|
716
|
+
readOnly: false,
|
|
717
|
+
params: [
|
|
718
|
+
{ name: "objectNames", type: "stringArray" },
|
|
719
|
+
{ name: "pivotType", type: "string", optional: true, default: "MEDIAN_POINT", enumValues: ["MEDIAN_POINT", "BOUNDING_BOX_CENTER", "CURSOR", "INDIVIDUAL_ORIGINS", "ACTIVE_ELEMENT"] },
|
|
720
|
+
],
|
|
721
|
+
build: (p) => objectPrelude +
|
|
722
|
+
`pivot_type = ${JSON.stringify((p.pivotType ?? "MEDIAN_POINT").upper())}\n` +
|
|
723
|
+
"bpy.context.tool_settings.transform_pivot_point = pivot_type\n" +
|
|
724
|
+
"result = {'pivot_point': pivot_type}\n",
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
name: "blender_set_transform_orientation",
|
|
728
|
+
title: "Set Transform Orientation",
|
|
729
|
+
description: "Set the transform orientation for selected objects.",
|
|
730
|
+
readOnly: false,
|
|
731
|
+
params: [
|
|
732
|
+
{ name: "objectNames", type: "stringArray" },
|
|
733
|
+
{ name: "orientation", type: "string", optional: true, default: "GLOBAL", enumValues: ["GLOBAL", "LOCAL", "NORMAL", "GIMBAL", "VIEW"] },
|
|
734
|
+
],
|
|
735
|
+
build: (p) => objectPrelude +
|
|
736
|
+
`orientation = ${JSON.stringify((p.orientation ?? "GLOBAL").upper())}\n` +
|
|
737
|
+
"bpy.context.scene.transform_orientation_slots[0].type = orientation\n" +
|
|
738
|
+
"result = {'orientation': orientation}\n",
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
name: "blender_set_snapping",
|
|
742
|
+
title: "Set Snapping",
|
|
743
|
+
description: "Configure snapping for the tool settings.",
|
|
744
|
+
readOnly: false,
|
|
745
|
+
params: [
|
|
746
|
+
{ name: "enabled", type: "boolean", optional: true, default: true },
|
|
747
|
+
{ name: "element", type: "string", optional: true, default: "FACE", enumValues: ["VERTEX", "EDGE", "FACE", "VOLUME", "EDGE_MIDPOINT", "EDGE_PERPENDICULAR"] },
|
|
748
|
+
{ name: "target", type: "string", optional: true, default: "ACTIVE", enumValues: ["ACTIVE", "MEDIAN", "CENTER", "CLOSEST"] },
|
|
749
|
+
],
|
|
750
|
+
build: (p) => "import bpy\n" +
|
|
751
|
+
`enabled = ${p.enabled === false ? "False" : "True"}\n` +
|
|
752
|
+
`element = ${JSON.stringify((p.element ?? "VERTEX").upper())}\n` +
|
|
753
|
+
`target = ${JSON.stringify((p.target ?? "ACTIVE").upper())}\n` +
|
|
754
|
+
"ts = bpy.context.scene.tool_settings\n" +
|
|
755
|
+
"ts.use_snap = enabled\n" +
|
|
756
|
+
"ts.snap_elements = {element}\n" +
|
|
757
|
+
"result = {'enabled': enabled, 'element': element}\n",
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
name: "blender_measure_distance",
|
|
761
|
+
title: "Measure Distance",
|
|
762
|
+
description: "Measure the world-space distance between two objects or points.",
|
|
763
|
+
readOnly: true,
|
|
764
|
+
params: [
|
|
765
|
+
{ name: "objectAName", type: "string" },
|
|
766
|
+
{ name: "objectBName", type: "string" },
|
|
767
|
+
],
|
|
768
|
+
build: (p) => "import bpy, math\n" +
|
|
769
|
+
`a_name = ${JSON.stringify(p.objectAName)}\n` +
|
|
770
|
+
`b_name = ${JSON.stringify(p.objectBName)}\n` +
|
|
771
|
+
"a = bpy.data.objects.get(a_name)\n" +
|
|
772
|
+
"b = bpy.data.objects.get(b_name)\n" +
|
|
773
|
+
"if a is None or b is None:\n" +
|
|
774
|
+
" raise RuntimeError('Both objects must exist')\n" +
|
|
775
|
+
"distance = (b.location - a.location).length\n" +
|
|
776
|
+
"result = {'objectA': a.name, 'objectB': b.name, 'distance': round(distance, 4), 'units': bpy.context.scene.unit_settings.length_unit}\n",
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
name: "blender_measure_angle",
|
|
780
|
+
title: "Measure Angle",
|
|
781
|
+
description: "Measure the angle formed by three objects at the vertex object.",
|
|
782
|
+
readOnly: true,
|
|
783
|
+
params: [
|
|
784
|
+
{ name: "vertexObject", type: "string" },
|
|
785
|
+
{ name: "objectAName", type: "string" },
|
|
786
|
+
{ name: "objectBName", type: "string" },
|
|
787
|
+
],
|
|
788
|
+
build: (p) => "import bpy, math\n" +
|
|
789
|
+
`vertex_name = ${JSON.stringify(p.vertexObject)}\n` +
|
|
790
|
+
`a_name = ${JSON.stringify(p.objectAName)}\n` +
|
|
791
|
+
`b_name = ${JSON.stringify(p.objectBName)}\n` +
|
|
792
|
+
"v_ref = bpy.data.objects.get(vertex_name)\n" +
|
|
793
|
+
"a = bpy.data.objects.get(a_name)\n" +
|
|
794
|
+
"b = bpy.data.objects.get(b_name)\n" +
|
|
795
|
+
"if v_ref is None or a is None or b is None:\n" +
|
|
796
|
+
" raise RuntimeError('All three objects must exist')\n" +
|
|
797
|
+
"va = a.location - v_ref.location\n" +
|
|
798
|
+
"vb = b.location - v_ref.location\n" +
|
|
799
|
+
"cos = va.dot(vb) / (va.length * vb.length)\n" +
|
|
800
|
+
"ang = math.acos(max(-1.0, min(1.0, cos)))\n" +
|
|
801
|
+
"result = {'vertex': v_ref.name, 'angle_degrees': round(math.degrees(ang), 4), 'angle_radians': round(ang, 6)}\n",
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
name: "blender_measure_area",
|
|
805
|
+
title: "Measure Area",
|
|
806
|
+
description: "Measure the total surface area of a mesh object.",
|
|
807
|
+
readOnly: true,
|
|
808
|
+
params: [{ name: "objectName", type: "string" }],
|
|
809
|
+
build: (p) => "import bpy\n" +
|
|
810
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
811
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
812
|
+
"if obj is None or obj.type != 'MESH':\n" +
|
|
813
|
+
" raise RuntimeError('Mesh object not found')\n" +
|
|
814
|
+
"area = sum(p.area for p in obj.data.polygons)\n" +
|
|
815
|
+
"result = {'object': obj.name, 'surface_area': round(area, 4), 'polygons': len(obj.data.polygons)}\n",
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
name: "blender_measure_volume",
|
|
819
|
+
title: "Measure Volume",
|
|
820
|
+
description: "Estimate the volume of a closed mesh object.",
|
|
821
|
+
readOnly: true,
|
|
822
|
+
params: [{ name: "objectName", type: "string" }],
|
|
823
|
+
build: (p) => "import bpy\n" +
|
|
824
|
+
`object_name = ${JSON.stringify(p.objectName)}\n` +
|
|
825
|
+
"obj = bpy.data.objects.get(object_name)\n" +
|
|
826
|
+
"if obj is None or obj.type != 'MESH':\n" +
|
|
827
|
+
" raise RuntimeError('Mesh object not found')\n" +
|
|
828
|
+
"meshes = [obj.data]\n" +
|
|
829
|
+
"deform = mesh.calc_volume() if hasattr(mesh, 'calc_volume') else None\n" +
|
|
830
|
+
"result = {'object': obj.name, 'volume': round(mesh.calc_volume(), 6) if hasattr(mesh, 'calc_volume') else None}\n",
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
name: "blender_validate_scale",
|
|
834
|
+
title: "Validate Scale",
|
|
835
|
+
description: "Check whether an object has uniform, non-negative scale.",
|
|
836
|
+
readOnly: true,
|
|
837
|
+
params: [
|
|
838
|
+
{ name: "objectNames", type: "stringArray", optional: true },
|
|
839
|
+
],
|
|
840
|
+
build: (p) => "import bpy\n" +
|
|
841
|
+
`names = ${JSON.stringify(p.objectNames ?? null)}\n` +
|
|
842
|
+
"objs = [bpy.data.objects.get(n) for n in (names or [])] if names else list(bpy.data.objects)\n" +
|
|
843
|
+
"objs = [o for o in objs if o]\n" +
|
|
844
|
+
"report = []\n" +
|
|
845
|
+
"for o in objs:\n" +
|
|
846
|
+
" uniform = abs(o.scale.x - o.scale.y) < 0.001 and abs(o.scale.y - o.scale.z) < 0.001\n" +
|
|
847
|
+
" non_negative = o.scale.x >= 0 and o.scale.y >= 0 and o.scale.z >= 0\n" +
|
|
848
|
+
" report.append({'name': o.name, 'scale': list(o.scale), 'uniform': uniform, 'non_negative': non_negative})\n" +
|
|
849
|
+
"invalid = [r['name'] for r in report if not (r['uniform'] and r['non_negative'])]\n" +
|
|
850
|
+
"result = {'report': report, 'invalid': invalid, 'count': len(invalid)}\n",
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
name: "blender_normalize_asset_scale",
|
|
854
|
+
title: "Normalize Asset Scale",
|
|
855
|
+
description: "Normalize objects to unit scale aligned to a target size.",
|
|
856
|
+
readOnly: false,
|
|
857
|
+
params: [
|
|
858
|
+
{ name: "objectNames", type: "stringArray" },
|
|
859
|
+
{ name: "targetSize", type: "number", optional: true, default: 1 },
|
|
860
|
+
{ name: "fit", type: "string", optional: true, default: "MAX", enumValues: ["MAX", "LONGEST"] },
|
|
861
|
+
],
|
|
862
|
+
build: (p) => "import bpy\n" +
|
|
863
|
+
"from mathutils import Vector\n" +
|
|
864
|
+
`names = ${JSON.stringify(p.objectNames ?? [])}\n` +
|
|
865
|
+
`target_size = ${JSON.stringify(p.targetSize ?? 1)}\n` +
|
|
866
|
+
"for name in names:\n" +
|
|
867
|
+
" o = bpy.data.objects.get(name)\n" +
|
|
868
|
+
" if o is None:\n" +
|
|
869
|
+
" continue\n" +
|
|
870
|
+
" bounds = [o.matrix_world @ Vector(c) for c in o.bound_box]\n" +
|
|
871
|
+
" size = Vector((\n" +
|
|
872
|
+
" max(p.x for p in bounds) - min(p.x for p in bounds),\n" +
|
|
873
|
+
" max(p.y for p in bounds) - min(p.y for p in bounds),\n" +
|
|
874
|
+
" max(p.z for p in bounds) - min(p.z for p in bounds),\n" +
|
|
875
|
+
" ))\n" +
|
|
876
|
+
" max_dim = max(size.x, size.y, size.z, 1e-6)\n" +
|
|
877
|
+
" scale = target_size / max_dim\n" +
|
|
878
|
+
" obj.scale = obj.scale * scale\n" +
|
|
879
|
+
"result = {'normalized': len(names), 'target_size': target_size}\n",
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
name: "blender_set_units",
|
|
883
|
+
title: "Set Units",
|
|
884
|
+
description: "Set the scene unit system and scale.",
|
|
885
|
+
readOnly: false,
|
|
886
|
+
params: [
|
|
887
|
+
{ name: "lengthUnit", type: "string", optional: true, default: "METERS", enumValues: ["NONE", "METERS", "CENTIMETERS", "MILLIMETERS", "FEET", "INCHES"] },
|
|
888
|
+
{ name: "scale", type: "number", optional: true, default: 1 },
|
|
889
|
+
{ name: "system", type: "string", optional: true, default: "METRIC", enumValues: ["METRIC", "IMPERIAL"] },
|
|
890
|
+
],
|
|
891
|
+
build: (p) => "import bpy\n" +
|
|
892
|
+
`system = ${JSON.stringify((p.system ?? "METRIC").upper())}\n` +
|
|
893
|
+
`length_unit = ${JSON.stringify((p.lengthUnit ?? "METERS").upper())}\n` +
|
|
894
|
+
`scale = ${JSON.stringify(p.scale ?? 1)}\n` +
|
|
895
|
+
"units = bpy.context.scene.unit_settings\n" +
|
|
896
|
+
"units.system = system\n" +
|
|
897
|
+
"units.system_units = 'INPUTS'\n" +
|
|
898
|
+
"units.length_unit = length_unit\n" +
|
|
899
|
+
"units.scale_length = scale\n" +
|
|
900
|
+
"result = {'system': system, 'length_unit': length_unit, 'scale_length': units.scale_length}\n",
|
|
901
|
+
},
|
|
902
|
+
];
|
|
903
|
+
// spin/array helpers used above
|
|
904
|
+
const objectPrelude = "import bpy\n" +
|
|
905
|
+
"if bpy.ops.object.mode_set.poll():\n" +
|
|
906
|
+
" bpy.ops.object.mode_set(mode='OBJECT')\n";
|