replicator-workshop 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. replicator/__init__.py +6 -0
  2. replicator/app.py +204 -0
  3. replicator/config.py +48 -0
  4. replicator/core/__init__.py +0 -0
  5. replicator/core/assembly.py +117 -0
  6. replicator/core/blender_link.py +161 -0
  7. replicator/core/critique.py +594 -0
  8. replicator/core/drawing.py +389 -0
  9. replicator/core/dxf.py +120 -0
  10. replicator/core/evaluate.py +439 -0
  11. replicator/core/explain.py +139 -0
  12. replicator/core/export.py +96 -0
  13. replicator/core/fit.py +170 -0
  14. replicator/core/importers.py +185 -0
  15. replicator/core/materials.py +104 -0
  16. replicator/core/ops_advanced.py +496 -0
  17. replicator/core/ops_engineering.py +223 -0
  18. replicator/core/physics.py +147 -0
  19. replicator/core/printers.py +100 -0
  20. replicator/core/program.py +298 -0
  21. replicator/core/render.py +145 -0
  22. replicator/core/reverse.py +350 -0
  23. replicator/core/robot.py +153 -0
  24. replicator/core/step.py +245 -0
  25. replicator/fixtures/gaming_pc_liquid.json +2259 -0
  26. replicator/fixtures/gas_generator_rocket.json +876 -0
  27. replicator/fixtures/gas_generator_rocket_aero.json +861 -0
  28. replicator/fixtures/house_two_bed.json +979 -0
  29. replicator/fixtures/quadcopter_drone.json +687 -0
  30. replicator/fixtures/raspberry_pi_5.json +884 -0
  31. replicator/fixtures/rocket_engine.json +652 -0
  32. replicator/fixtures/turbofan.json +931 -0
  33. replicator/fixtures/vector_engine.json +314 -0
  34. replicator/gpu.py +81 -0
  35. replicator/image3d/__init__.py +0 -0
  36. replicator/image3d/comfy.py +181 -0
  37. replicator/image3d/pipeline.py +208 -0
  38. replicator/image3d/sheet.py +154 -0
  39. replicator/knowledge/__init__.py +61 -0
  40. replicator/knowledge/car_wheel_corner.md +21 -0
  41. replicator/knowledge/desk_lamp.md +21 -0
  42. replicator/knowledge/desktop_pc.md +20 -0
  43. replicator/knowledge/electronics_board.md +21 -0
  44. replicator/knowledge/exoskeleton.md +21 -0
  45. replicator/knowledge/house.md +22 -0
  46. replicator/knowledge/light_aircraft.md +22 -0
  47. replicator/knowledge/multirotor_drone.md +25 -0
  48. replicator/knowledge/print_replica.md +13 -0
  49. replicator/knowledge/rocket_engine.md +27 -0
  50. replicator/knowledge/turbofan.md +23 -0
  51. replicator/llm/__init__.py +0 -0
  52. replicator/llm/client.py +424 -0
  53. replicator/llm/prompts/blueprint.md +28 -0
  54. replicator/llm/prompts/edit.md +15 -0
  55. replicator/llm/prompts/explain.md +37 -0
  56. replicator/llm/prompts/name_parts.md +13 -0
  57. replicator/llm/prompts/program.md +72 -0
  58. replicator/llm/prompts/research_queries.md +8 -0
  59. replicator/mcp_server.py +307 -0
  60. replicator/qml/Main.qml +874 -0
  61. replicator/qml/Replicator/UI/Chip.qml +17 -0
  62. replicator/qml/Replicator/UI/DockHeader.qml +27 -0
  63. replicator/qml/Replicator/UI/Icon.qml +118 -0
  64. replicator/qml/Replicator/UI/IconButton.qml +31 -0
  65. replicator/qml/Replicator/UI/Kbd.qml +18 -0
  66. replicator/qml/Replicator/UI/NumField.qml +69 -0
  67. replicator/qml/Replicator/UI/Pill.qml +28 -0
  68. replicator/qml/Replicator/UI/RCombo.qml +51 -0
  69. replicator/qml/Replicator/UI/RMenu.qml +42 -0
  70. replicator/qml/Replicator/UI/RSlider.qml +23 -0
  71. replicator/qml/Replicator/UI/Segmented.qml +63 -0
  72. replicator/qml/Replicator/UI/Swatch.qml +47 -0
  73. replicator/qml/Replicator/UI/Theme.qml +149 -0
  74. replicator/qml/Replicator/UI/qmldir +14 -0
  75. replicator/qml/panels/AgentPrompt.qml +53 -0
  76. replicator/qml/panels/AttributeManager.qml +171 -0
  77. replicator/qml/panels/Commander.qml +136 -0
  78. replicator/qml/panels/HolodeckPanel.qml +117 -0
  79. replicator/qml/panels/IssuesCard.qml +78 -0
  80. replicator/qml/panels/LedgerPanel.qml +110 -0
  81. replicator/qml/panels/MaterialShelf.qml +97 -0
  82. replicator/qml/panels/ObjectManager.qml +107 -0
  83. replicator/qml/panels/Preferences.qml +211 -0
  84. replicator/qml/panels/Presenter.qml +316 -0
  85. replicator/qml/panels/StatusBar.qml +77 -0
  86. replicator/qml/panels/Timeline.qml +149 -0
  87. replicator/qml/panels/Welcome.qml +126 -0
  88. replicator/qml/viewport/Callouts.qml +87 -0
  89. replicator/qml/viewport/EdgeMaterial.qml +16 -0
  90. replicator/qml/viewport/GridMaterial.qml +16 -0
  91. replicator/qml/viewport/HoloMaterial.qml +23 -0
  92. replicator/qml/viewport/NavGizmo.qml +72 -0
  93. replicator/qml/viewport/ReferenceMaterial.qml +17 -0
  94. replicator/qml/viewport/Viewport.qml +583 -0
  95. replicator/qt/__init__.py +0 -0
  96. replicator/qt/bridge.py +1427 -0
  97. replicator/qt/drawing_sheet.py +33 -0
  98. replicator/qt/envmap.py +40 -0
  99. replicator/qt/library.py +68 -0
  100. replicator/qt/mesh_geometry.py +167 -0
  101. replicator/qt/svg.py +41 -0
  102. replicator/research/__init__.py +0 -0
  103. replicator/research/lane.py +281 -0
  104. replicator/shaders/edge.frag +9 -0
  105. replicator/shaders/edge.vert +7 -0
  106. replicator/shaders/grid.frag +52 -0
  107. replicator/shaders/grid.vert +6 -0
  108. replicator/shaders/holo.frag +41 -0
  109. replicator/shaders/reference.frag +15 -0
  110. replicator/shaders/reference.vert +6 -0
  111. replicator/voice.py +120 -0
  112. replicator_workshop-0.1.0.dist-info/METADATA +410 -0
  113. replicator_workshop-0.1.0.dist-info/RECORD +118 -0
  114. replicator_workshop-0.1.0.dist-info/WHEEL +5 -0
  115. replicator_workshop-0.1.0.dist-info/entry_points.txt +3 -0
  116. replicator_workshop-0.1.0.dist-info/licenses/LICENSE +21 -0
  117. replicator_workshop-0.1.0.dist-info/licenses/vendor/mcp-for-blender/LICENSE +21 -0
  118. replicator_workshop-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,874 @@
1
+ import QtQuick
2
+ import QtQuick.Controls
3
+ import QtQuick.Layouts
4
+ import QtQuick.Dialogs
5
+ import QtQuick.Shapes
6
+ import QtQml
7
+ import QtCore
8
+ import Replicator.UI
9
+ import "panels"
10
+ import "viewport"
11
+
12
+ // Replicator: a studio workspace for local models. Header (menus, modes, Commander), tool rail, the viewport with
13
+ // its floating bars and the dream capsule, the manager dock on the right, the build timeline and a status bar.
14
+ // Every command lives once in `actions`: the menus, the keyboard shortcuts and the Commander all read that list.
15
+ ApplicationWindow {
16
+ id: window
17
+ width: 1760
18
+ height: 1020
19
+ visible: true
20
+ title: "Replicator — " + studio.title
21
+ color: Theme.bg
22
+
23
+ palette.window: Theme.panel
24
+ palette.windowText: Theme.text
25
+ palette.base: Theme.field
26
+ palette.alternateBase: Theme.panel2
27
+ palette.text: Theme.text
28
+ palette.button: Theme.panel2
29
+ palette.buttonText: Theme.text
30
+ palette.highlight: Theme.accent
31
+ palette.highlightedText: Theme.onAccent
32
+ palette.toolTipBase: Theme.raised
33
+ palette.toolTipText: Theme.text
34
+ palette.placeholderText: Theme.faint
35
+ palette.mid: Theme.line
36
+ palette.dark: Theme.bg
37
+ palette.light: Theme.line
38
+
39
+ // ------------------------------------------------------------------ state
40
+ property real blueprint: 0.0
41
+ property real explodeTarget: 0.0
42
+ property real explode: explodeTarget
43
+ Behavior on explode { NumberAnimation { duration: 650; easing.type: Easing.OutCubic } }
44
+ property var hidden: ({})
45
+ property string isolate: ""
46
+ readonly property string part: studio.selectedComponent
47
+ readonly property string partLabel: { const c = studio.components.find(c => c.id === part); return c ? c.label : part }
48
+ readonly property bool idle: studio.busy === ""
49
+ readonly property bool showcase: studio.mode === "showcase"
50
+ readonly property bool present: studio.mode === "present"
51
+ readonly property bool empty: studio.stepCount === 0
52
+ property bool needFrame: true
53
+ property bool playing: false // set by the launcher: play the build once it is loaded
54
+ onPlayingChanged: if (playing) timeline.play(1)
55
+
56
+ // workspace layout, remembered between sessions
57
+ property bool showLeft: true
58
+ property bool showRight: true
59
+ property bool showTimeline: true
60
+ property bool showGrid: true
61
+ property bool showReference: true
62
+ property bool focusMode: false // F11: the viewport alone
63
+ property real rightWidth: 380
64
+ property int rightTab: 0
65
+ Settings {
66
+ category: "workspace"
67
+ property alias showLeft: window.showLeft
68
+ property alias showRight: window.showRight
69
+ property alias showTimeline: window.showTimeline
70
+ property alias showGrid: window.showGrid
71
+ property alias showReference: window.showReference
72
+ property alias rightWidth: window.rightWidth
73
+ }
74
+ readonly property bool chrome: !showcase && !present && !focusMode
75
+
76
+ Component.onCompleted: {
77
+ if (boot.theme) Theme.themeName = boot.theme
78
+ if (boot.accent) Theme.accentName = boot.accent
79
+ if (boot.density) Theme.density = boot.density
80
+ if (boot.ui === "commander" || boot.ui === "preferences" || boot.ui === "context") bootUi.start()
81
+ if (boot.ui === "materials") rightTab = 1
82
+ if (boot.ui === "console") rightTab = 2
83
+ if (boot.ui === "issues") issuesCard.open = true
84
+ }
85
+
86
+ Timer { id: bootUi; interval: 400
87
+ onTriggered: boot.ui === "commander" ? commander.open()
88
+ : boot.ui === "context" ? window.openContext(studio.shapes.length ? studio.shapes[0].shapeId : "", 760, 330)
89
+ : preferences.open() }
90
+
91
+ function runCue(js) { return eval(js) } // --record: a scripted moment of a preview film (QML ids in scope)
92
+ function setMode(m) {
93
+ studio.setMode(m)
94
+ if (m === "build") { explodeTarget = 0; viewport.colorByComponent = false; isolate = "" }
95
+ if (m === "dissect") { explodeTarget = Math.max(explodeTarget, 0.8); viewport.colorByComponent = true; viewport.frameAll(true) }
96
+ if (m === "build") viewport.frameAll(true)
97
+ if (m === "reverse") { viewport.colorByComponent = true }
98
+ if (m === "showcase") { timeline.stop(); studio.setStep(studio.stepCount - 1); viewport.colorByComponent = false
99
+ viewport.heroAngle(); viewport.frameAll(true) }
100
+ if (m === "present") { viewport.colorByComponent = false; presenter.start() }
101
+ }
102
+ function toggleHidden(cid) { const h = Object.assign({}, hidden); h[cid] = !h[cid]; hidden = h }
103
+ function playComponent(cid) {
104
+ const steps = studio.ops.filter(o => o.component === cid).map(o => o.index)
105
+ if (!steps.length) return
106
+ isolate = cid
107
+ studio.setStep(steps[0])
108
+ timeline.playlist = steps
109
+ timeline.playDir = 1
110
+ }
111
+ function openPath(path) {
112
+ studio.openFile(path)
113
+ if (studio.mode === "build") timeline.play(1)
114
+ }
115
+ function val(x) { return typeof x === "function" ? x() : x }
116
+ function openContext(shapeId, x, y) {
117
+ studio.select(shapeId)
118
+ ctxMenu.actions = window.pick(part !== "" ? partMenu : sceneMenu)
119
+ ctxMenu.x = Math.min(x, window.width - ctxMenu.implicitWidth - 8)
120
+ ctxMenu.y = Math.min(y, window.height - ctxMenu.actions.length * Theme.row - 16)
121
+ ctxMenu.open()
122
+ }
123
+ readonly property var partMenu: ["part.frame", "part.isolate", "part.hide", "part.play", "-", "part.rework", "part.material",
124
+ "-", "part.duplicate", "part.delete", "-", "showAll", "fixIssues"]
125
+ readonly property var sceneMenu: ["frameAll", "showAll", "-", "disp.shaded", "disp.lines", "disp.xray", "-",
126
+ "add.tube", "add.nozzle", "add.rotor", "add.grille", "add.box", "add.cylinder", "-", "fixIssues", "blenderOpen"]
127
+
128
+ // ------------------------------------------------------------------ the action registry
129
+ readonly property var actions: [
130
+ // file
131
+ { id: "open", group: "File", title: "Open…", keys: "Ctrl+O", icon: "folder", run: () => openDlg.open() },
132
+ { id: "import", group: "File", title: "Import a model to reverse engineer…", keys: "Ctrl+I", icon: "importIn", run: () => importDlg.open() },
133
+ { id: "image3d", group: "File", title: "Image to 3D…", keys: "Ctrl+Shift+I", icon: "image", run: () => image3DDlg.open() },
134
+ { id: "exportGlb", group: "File", title: "Export GLB", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("glb") },
135
+ { id: "exportStl", group: "File", title: "Export STL for 3D printing", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("stl") },
136
+ { id: "export3mf", group: "File", title: "Export 3MF for printing", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("3mf") },
137
+ { id: "exportDxf", group: "File", title: "Export DXF (views at full size, for CAD and laser)", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("dxf") },
138
+ { id: "exportSim", group: "File", title: "Export for simulators (URDF and MJCF)", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("sim") },
139
+ { id: "exportStep", group: "File", title: "Export STEP for CAD (faceted solids)", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("step") },
140
+ { id: "exportObj", group: "File", title: "Export OBJ", icon: "exportOut", enabled: () => !window.empty, run: () => studio.exportAs("obj") },
141
+ { id: "close", group: "File", title: "Close the build (start screen)", keys: "Ctrl+W", icon: "close", enabled: () => !window.empty, run: () => { timeline.stop(); window.setMode("build"); studio.closeProgram() } },
142
+ // edit
143
+ { id: "undo", group: "Edit", title: "Undo", keys: "Ctrl+Z", icon: "undo", enabled: () => studio.canUndo, run: () => studio.undo() },
144
+ { id: "redo", group: "Edit", title: "Redo", keys: "Ctrl+Shift+Z", icon: "redo", enabled: () => studio.canRedo, run: () => studio.redo() },
145
+ { id: "deselect", group: "Edit", title: "Deselect", keys: "Esc", run: () => { if (studio.sheet.png !== undefined) studio.closeSheet(); else if (window.present) window.setMode("reverse"); else if (window.showcase || window.focusMode) { window.focusMode = false; if (window.showcase) window.setMode("build") } else if (viewport.tool === "measure") viewport.tool = "select"; else { studio.select(""); window.isolate = "" } } },
146
+ { id: "fixIssues", group: "Edit", title: "Fix accuracy issues with the agent", icon: "sparkle", enabled: () => window.idle && studio.issues.some(i => i.severity === "fix"), run: () => studio.fixIssues() },
147
+ { id: "showAll", group: "Edit", title: "Show everything", icon: "eye", run: () => { window.hidden = ({}); window.isolate = "" } },
148
+ { id: "commander", group: "Edit", title: "Commander: search every action", keys: "Ctrl+K", icon: "search", run: () => commander.open() },
149
+ { id: "preferences", group: "Edit", title: "Preferences…", keys: "Ctrl+,", icon: "sliders", run: () => preferences.open() },
150
+ // create
151
+ { id: "add.box", group: "Create", title: "Box", icon: "box", run: () => studio.addPrimitive("box") },
152
+ { id: "add.cylinder", group: "Create", title: "Cylinder", icon: "cylinder", run: () => studio.addPrimitive("cylinder") },
153
+ { id: "add.sphere", group: "Create", title: "Sphere", icon: "sphere", run: () => studio.addPrimitive("sphere") },
154
+ { id: "add.torus", group: "Create", title: "Torus", icon: "torus", run: () => studio.addPrimitive("torus") },
155
+ { id: "add.capsule", group: "Create", title: "Capsule", icon: "capsule", run: () => studio.addPrimitive("capsule") },
156
+ { id: "add.gear", group: "Create", title: "Gear", icon: "gear", run: () => studio.addPrimitive("gear") },
157
+ { id: "add.helix", group: "Create", title: "Spring (helix)", icon: "helix", run: () => studio.addPrimitive("helix") },
158
+ { id: "add.pipe", group: "Create", title: "Pipe", icon: "pipe", run: () => studio.addPrimitive("pipe") },
159
+ { id: "add.loft", group: "Create", title: "Loft", icon: "loft", run: () => studio.addPrimitive("loft") },
160
+ { id: "add.tube", group: "Create", title: "Tube (hollow casing)", icon: "cylinder", run: () => studio.addPrimitive("tube") },
161
+ { id: "add.nozzle", group: "Create", title: "Rocket nozzle (bell)", icon: "loft", run: () => studio.addPrimitive("nozzle") },
162
+ { id: "add.rotor", group: "Create", title: "Rotor (fan, turbine, propeller)", icon: "spin", run: () => studio.addPrimitive("rotor") },
163
+ { id: "add.grille", group: "Create", title: "Grille (vent plate)", icon: "grid", run: () => studio.addPrimitive("grille") },
164
+ // the selected part (right-click menu and Commander)
165
+ { id: "part.frame", group: "Part", title: "Frame this part", icon: "target", enabled: () => window.part !== "", run: () => viewport.frameComponent(window.part) },
166
+ { id: "part.isolate", group: "Part", title: "Isolate", icon: "target", checked: () => window.part !== "" && window.isolate === window.part, enabled: () => window.part !== "", run: () => window.isolate = window.isolate === window.part ? "" : window.part },
167
+ { id: "part.hide", group: "Part", title: "Hide", keys: "Ctrl+H", icon: "eyeOff", enabled: () => window.part !== "", run: () => window.toggleHidden(window.part) },
168
+ { id: "part.play", group: "Part", title: "Play how it is made", icon: "play", enabled: () => window.part !== "", run: () => window.playComponent(window.part) },
169
+ { id: "part.rework", group: "Part", title: "Rework with the agent…", keys: "Ctrl+E", icon: "sparkle", enabled: () => window.part !== "" && window.idle, run: () => { agentPrompt.cid = window.part; agentPrompt.label = window.partLabel; agentPrompt.open() } },
170
+ { id: "part.material", group: "Part", title: "Paint a material…", icon: "material", enabled: () => window.part !== "", run: () => { window.showRight = true; window.rightTab = 1 } },
171
+ { id: "part.duplicate", group: "Part", title: "Duplicate", keys: "Ctrl+D", icon: "copy", enabled: () => window.part !== "" && window.idle, run: () => studio.duplicateComponent(window.part) },
172
+ { id: "part.delete", group: "Part", title: "Delete", keys: "Delete", icon: "trash", enabled: () => window.part !== "" && window.idle, run: () => studio.deleteComponent(window.part) },
173
+ // tools
174
+ { id: "tool.select", group: "Tool", title: "Select tool", icon: "cursor", checked: () => viewport.tool === "select", run: () => viewport.tool = "select" },
175
+ { id: "tool.measure", group: "Tool", title: "Measure distance", keys: "D", icon: "ruler", checked: () => viewport.tool === "measure", run: () => viewport.tool = viewport.tool === "measure" ? "select" : "measure" },
176
+ { id: "tool.move", group: "Tool", title: "Move tool", keys: "W", icon: "move", checked: () => viewport.tool === "move", run: () => viewport.tool = viewport.tool === "move" ? "select" : "move" },
177
+ // view
178
+ { id: "frameAll", group: "View", title: "Frame everything", keys: "H", icon: "frame", run: () => viewport.frameAll(true) },
179
+ { id: "frameSel", group: "View", title: "Frame the selection", keys: "F", icon: "target", run: () => viewport.frameSelected() },
180
+ { id: "view.persp", group: "View", title: "Perspective view", keys: "F1", run: () => viewport.setView("Perspective") },
181
+ { id: "view.top", group: "View", title: "Top view", keys: "F2", run: () => viewport.setView("Top") },
182
+ { id: "view.right", group: "View", title: "Right view", keys: "F3", run: () => viewport.setView("Right") },
183
+ { id: "view.front", group: "View", title: "Front view", keys: "F4", run: () => viewport.setView("Front") },
184
+ { id: "disp.shaded", group: "View", title: "Display: shaded", icon: "shaded", checked: () => viewport.displayMode === "shaded", run: () => viewport.displayMode = "shaded" },
185
+ { id: "disp.lines", group: "View", title: "Display: shaded with lines", icon: "lines", checked: () => viewport.displayMode === "lines", run: () => viewport.displayMode = "lines" },
186
+ { id: "disp.wire", group: "View", title: "Display: wireframe", icon: "wire", checked: () => viewport.displayMode === "wire", run: () => viewport.displayMode = "wire" },
187
+ { id: "disp.xray", group: "View", title: "Display: x-ray", icon: "xray", checked: () => viewport.displayMode === "xray", run: () => viewport.displayMode = "xray" },
188
+ { id: "colorComp", group: "View", title: "Colour by component", keys: "C", icon: "layers", checked: () => viewport.colorByComponent, run: () => viewport.colorByComponent = !viewport.colorByComponent },
189
+ { id: "grid", group: "View", title: "Floor grid", keys: "G", icon: "grid", checked: () => window.showGrid, run: () => window.showGrid = !window.showGrid },
190
+ { id: "reference", group: "View", title: "Reference images", keys: "R", icon: "reference", checked: () => window.showReference, run: () => window.showReference = !window.showReference },
191
+ { id: "blueprint", group: "View", title: "Blueprint look on / off", keys: "B", icon: "ruler", checked: () => window.blueprint > 0.5, run: () => bpAnim.go(window.blueprint > 0.5 ? 0 : 1) },
192
+ // timeline
193
+ { id: "play", group: "Timeline", title: "Play / pause the build", keys: "Space", icon: "play", run: () => window.present ? presenter.togglePlay() : timeline.playDir !== 0 ? timeline.stop() : timeline.play(1) },
194
+ { id: "disassemble", group: "Timeline", title: "Disassemble (play backward)", keys: "Shift+Space", icon: "playBack", run: () => timeline.play(-1) },
195
+ { id: "stepPrev", group: "Timeline", title: "Previous step", keys: "Left", run: () => { if (window.present) return presenter.prev(); timeline.stop(); studio.setStep(studio.step - 1) } },
196
+ { id: "stepNext", group: "Timeline", title: "Next step", keys: "Right", run: () => { if (window.present) return presenter.next(); timeline.stop(); studio.setStep(studio.step + 1) } },
197
+ // modes
198
+ { id: "mode.build", group: "Mode", title: "Build mode", keys: "1", icon: "build", checked: () => studio.mode === "build", run: () => window.setMode("build") },
199
+ { id: "mode.dissect", group: "Mode", title: "Dissect mode (exploded view)", keys: "2", icon: "dissect", checked: () => studio.mode === "dissect", run: () => window.setMode("dissect") },
200
+ { id: "mode.reverse", group: "Mode", title: "Reverse mode (take a model apart)", keys: "3", icon: "reverse", checked: () => studio.mode === "reverse", run: () => window.setMode("reverse") },
201
+ { id: "mode.showcase", group: "Mode", title: "Showcase mode (product stage)", keys: "4", icon: "showcase", checked: () => studio.mode === "showcase", run: () => window.setMode("showcase") },
202
+ { id: "mode.present", group: "Mode", title: "Present mode (play the explanation)", keys: "5", icon: "present", checked: () => studio.mode === "present", run: () => window.setMode("present") },
203
+ // render
204
+ { id: "render", group: "Render", title: "Render a still (Cycles, CPU)", keys: "Ctrl+R", icon: "render", enabled: () => !window.empty && studio.busy === "", run: () => studio.renderShowcase(viewport.cameraJson()) },
205
+ { id: "sheet.blueprint", group: "Render", title: "Blueprint sheet (A3, dimensioned, parts list)", keys: "Ctrl+Shift+B", icon: "ruler", enabled: () => !window.empty && studio.busy === "", run: () => studio.makeSheet("blueprint") },
206
+ { id: "sheet.paper", group: "Render", title: "Drawing sheet on white paper (A3, for print)", icon: "printer", enabled: () => !window.empty && studio.busy === "", run: () => studio.makeSheet("paper") },
207
+ { id: "blenderOpen", group: "Render", title: "Open in Blender (MCP socket)", icon: "external", enabled: () => !window.empty && studio.busy === "", run: () => studio.openInBlender() },
208
+ { id: "blenderPull", group: "Render", title: "Pull back from Blender", icon: "importIn", enabled: () => studio.busy === "", run: () => studio.pullFromBlender() },
209
+ { id: "nameParts", group: "Reverse", title: "Name the parts with the local model", icon: "sparkle", enabled: () => !window.empty && studio.busy === "", run: () => studio.nameParts() },
210
+ { id: "explain", group: "Reverse", title: "Explain how it works", icon: "book", enabled: () => !window.empty && studio.busy === "", run: () => studio.explain() },
211
+ // window
212
+ { id: "toggleLeft", group: "Window", title: "Tool rail", icon: "panelLeft", checked: () => window.showLeft, run: () => window.showLeft = !window.showLeft },
213
+ { id: "toggleRight", group: "Window", title: "Manager dock", keys: "Ctrl+J", icon: "panelRight", checked: () => window.showRight, run: () => window.showRight = !window.showRight },
214
+ { id: "toggleTimeline", group: "Window", title: "Timeline", keys: "Ctrl+T", icon: "panelBottom", checked: () => window.showTimeline, run: () => window.showTimeline = !window.showTimeline },
215
+ { id: "focus", group: "Window", title: "Focus mode: the viewport alone", keys: "F11", icon: "frame", checked: () => window.focusMode, run: () => window.focusMode = !window.focusMode },
216
+ { id: "tab.attributes", group: "Window", title: "Show attributes", icon: "sliders", run: () => { window.showRight = true; window.rightTab = 0 } },
217
+ { id: "tab.materials", group: "Window", title: "Show the material shelf", keys: "M", icon: "material", run: () => { window.showRight = true; window.rightTab = 1 } },
218
+ { id: "tab.console", group: "Window", title: "Show the console", keys: "`", icon: "terminal", run: () => { window.showRight = true; window.rightTab = 2 } }
219
+ ]
220
+ readonly property var byId: { const m = {}; for (const a of actions) m[a.id] = a; return m }
221
+ function pick(ids) { return ids.map(i => i === "-" ? "-" : byId[i]) }
222
+ readonly property var menus: [
223
+ { title: "File", items: ["open", "import", "image3d", "-", "exportGlb", "exportStl", "export3mf", "exportStep", "exportObj", "exportDxf", "exportSim", "-", "close"] },
224
+ { title: "Edit", items: ["undo", "redo", "-", "deselect", "showAll", "-", "fixIssues", "-", "commander", "preferences"] },
225
+ { title: "Create", items: ["add.box", "add.cylinder", "add.sphere", "add.torus", "add.capsule", "-", "add.gear", "add.helix", "add.pipe", "add.loft",
226
+ "-", "add.tube", "add.nozzle", "add.rotor", "add.grille"] },
227
+ { title: "Part", items: ["part.frame", "part.isolate", "part.hide", "part.play", "-", "part.rework", "part.material", "-", "part.duplicate", "part.delete"] },
228
+ { title: "View", items: ["frameAll", "frameSel", "-", "view.persp", "view.top", "view.right", "view.front", "-",
229
+ "disp.shaded", "disp.lines", "disp.wire", "disp.xray", "-", "colorComp", "blueprint", "grid", "reference"] },
230
+ { title: "Render", items: ["mode.showcase", "render", "-", "sheet.blueprint", "sheet.paper", "-", "blenderOpen", "blenderPull"] },
231
+ { title: "Window", items: ["mode.build", "mode.dissect", "mode.reverse", "mode.showcase", "mode.present", "-", "explain",
232
+ "-", "toggleLeft", "toggleRight", "toggleTimeline", "focus", "-", "tab.attributes", "tab.materials", "tab.console"] }
233
+ ]
234
+ Instantiator {
235
+ model: window.actions.filter(a => !!a.keys)
236
+ delegate: Shortcut {
237
+ required property var modelData
238
+ sequence: modelData.keys
239
+ context: Qt.WindowShortcut
240
+ enabled: !commander.visible && !preferences.visible
241
+ onActivated: if (modelData.enabled === undefined || modelData.enabled()) modelData.run()
242
+ }
243
+ }
244
+ NumberAnimation { id: bpAnim; target: window; property: "blueprint"; duration: 600; easing.type: Easing.InOutCubic
245
+ function go(v) { to = v; restart() } }
246
+
247
+ Connections {
248
+ target: studio
249
+ function onProgramChanged() { window.needFrame = true }
250
+ function onShapesChanged() { if (window.needFrame) { window.needFrame = false; viewport.frameAll(false) } }
251
+ function onModeChanged() {
252
+ if (studio.mode === "reverse") { viewport.colorByComponent = true; if (window.explodeTarget < 0.5) window.explodeTarget = 0.6 }
253
+ }
254
+ }
255
+
256
+ FileDialog {
257
+ id: openDlg
258
+ title: "Open a BuildProgram or import a model"
259
+ nameFilters: ["Replicator programs and models (*.json " + studio.importPatterns + ")", "BuildProgram (*.json)",
260
+ "3D models, CAD and gallery bundles (" + studio.importPatterns + ")"]
261
+ onAccepted: window.openPath(selectedFile.toString())
262
+ }
263
+ FileDialog {
264
+ id: importDlg
265
+ title: "Import a model to reverse engineer"
266
+ nameFilters: ["3D models, CAD and gallery bundles (" + studio.importPatterns + ")"]
267
+ onAccepted: studio.importModel(selectedFile.toString())
268
+ }
269
+ FileDialog {
270
+ id: image3DDlg
271
+ title: "Turn a picture into a 3D model (Hunyuan3D)"
272
+ nameFilters: ["Images (*.png *.jpg *.jpeg)"]
273
+ onAccepted: studio.imageTo3D(selectedFile.toString(), false)
274
+ }
275
+
276
+ Commander {
277
+ id: commander
278
+ actions: window.actions
279
+ onOpenFile: (path) => window.openPath(path)
280
+ }
281
+ Preferences { id: preferences; workspace: window }
282
+ RMenu { id: ctxMenu; implicitWidth: 250 }
283
+ AgentPrompt { id: agentPrompt; onSubmitted: (cid, text) => studio.rework(cid, text) }
284
+
285
+ // ------------------------------------------------------------------ header: brand, menus, modes, Commander, engine
286
+ header: Rectangle {
287
+ height: window.chrome ? 44 : 0
288
+ visible: height > 0
289
+ clip: true
290
+ color: Theme.header
291
+ Behavior on height { NumberAnimation { duration: Theme.med } }
292
+ Rectangle { anchors.bottom: parent.bottom; width: parent.width; height: 1; color: Theme.line }
293
+ RowLayout {
294
+ anchors.fill: parent
295
+ anchors.leftMargin: 12; anchors.rightMargin: 10
296
+ spacing: 2
297
+ Rectangle { // brand mark
298
+ implicitWidth: 26; implicitHeight: 26; radius: 7
299
+ gradient: Gradient {
300
+ GradientStop { position: 0; color: Theme.accentHi }
301
+ GradientStop { position: 1; color: Theme.accent }
302
+ }
303
+ Icon { anchors.centerIn: parent; name: "box"; size: 16; color: Theme.onAccent; stroke: 1.9 }
304
+ }
305
+ Text { text: "REPLICATOR"; color: Theme.text; font.family: Theme.sans; font.weight: Font.Bold; font.letterSpacing: 3.2
306
+ font.pixelSize: 12; Layout.leftMargin: 8; Layout.rightMargin: 14 }
307
+ Repeater {
308
+ model: window.menus
309
+ delegate: Rectangle {
310
+ id: hm
311
+ required property var modelData
312
+ implicitWidth: hmt.implicitWidth + 18; implicitHeight: 28; radius: Theme.r1
313
+ color: hmenu.visible ? Theme.press : hmm.containsMouse ? Theme.hover : "transparent"
314
+ Text { id: hmt; anchors.centerIn: parent; text: hm.modelData.title
315
+ color: hmenu.visible || hmm.containsMouse ? Theme.text : Theme.dim
316
+ font.pixelSize: Theme.fs; font.family: Theme.sans }
317
+ MouseArea { id: hmm; anchors.fill: parent; hoverEnabled: true; onClicked: hmenu.open() }
318
+ RMenu { id: hmenu; y: parent.height + 5; actions: window.pick(hm.modelData.items) }
319
+ }
320
+ }
321
+ Item { Layout.fillWidth: true }
322
+ Segmented {
323
+ segWidth: window.width < 1180 ? 40 : window.width < 1500 ? 100 : 112
324
+ iconsOnly: window.width < 1180
325
+ hints: window.width >= 1500
326
+ current: studio.mode
327
+ model: [ { key: "build", label: "Build", icon: "build", hint: "1" }, { key: "dissect", label: "Dissect", icon: "dissect", hint: "2" },
328
+ { key: "reverse", label: "Reverse", icon: "reverse", hint: "3" }, { key: "showcase", label: "Showcase", icon: "showcase", hint: "4" },
329
+ { key: "present", label: "Present", icon: "present", hint: "5" } ]
330
+ onPick: (k) => window.setMode(k)
331
+ }
332
+ Item { Layout.fillWidth: true }
333
+ Row { // running job
334
+ visible: studio.busy !== ""
335
+ spacing: 7; Layout.rightMargin: 10
336
+ Icon { name: "spin"; size: 15; color: Theme.accentHi; anchors.verticalCenter: parent.verticalCenter
337
+ RotationAnimation on rotation { running: studio.busy !== ""; from: 0; to: 360; duration: 1100; loops: Animation.Infinite } }
338
+ Text { text: studio.busy; color: Theme.accentHi; font.pixelSize: Theme.fsSmall; font.family: Theme.sans
339
+ anchors.verticalCenter: parent.verticalCenter }
340
+ }
341
+ Rectangle { // Commander entry: a full search field, or a round button on a narrow window
342
+ readonly property bool full: window.width >= 1500
343
+ implicitWidth: full ? 214 : 28; implicitHeight: 28; radius: 14
344
+ color: cmdMa.containsMouse ? Theme.hover : Theme.field
345
+ border.color: cmdMa.containsMouse ? Theme.accentLine : Theme.line
346
+ Icon { x: parent.full ? 10 : 7; anchors.verticalCenter: parent.verticalCenter; name: "search"; size: 14; color: Theme.dim }
347
+ Text { x: 31; anchors.verticalCenter: parent.verticalCenter; text: "Search actions"; color: Theme.faint
348
+ font.pixelSize: Theme.fsSmall; font.family: Theme.sans; visible: parent.full }
349
+ ToolTip.visible: !full && cmdMa.containsMouse
350
+ ToolTip.text: "Search actions Ctrl+K"
351
+ ToolTip.delay: 450
352
+ Kbd { visible: parent.full; anchors.right: parent.right; anchors.rightMargin: 7; anchors.verticalCenter: parent.verticalCenter; keys: "Ctrl+K" }
353
+ MouseArea { id: cmdMa; anchors.fill: parent; hoverEnabled: true; cursorShape: Qt.PointingHandCursor; onClicked: commander.open() }
354
+ }
355
+ Text { visible: window.width >= 1500; text: "MODEL"; color: Theme.faint; font.pixelSize: Theme.fsTiny; font.letterSpacing: Theme.caps
356
+ font.weight: Font.DemiBold; font.family: Theme.sans; Layout.leftMargin: 12; Layout.rightMargin: 4 }
357
+ RCombo {
358
+ model: studio.engines; implicitWidth: 104
359
+ currentIndex: Math.max(0, studio.engines.indexOf(studio.engine))
360
+ onActivated: studio.setEngine(currentText)
361
+ }
362
+ IconButton { icon: "sliders"; tip: "Preferences"; keys: "Ctrl+,"; onHit: preferences.open(); Layout.leftMargin: 4 }
363
+ }
364
+ }
365
+
366
+ // ------------------------------------------------------------------ footer: status bar
367
+ footer: StatusBar {
368
+ height: window.chrome ? implicitHeight : 0
369
+ visible: height > 0
370
+ clip: true
371
+ Behavior on height { NumberAnimation { duration: Theme.med } }
372
+ }
373
+
374
+ // ------------------------------------------------------------------ body
375
+ RowLayout {
376
+ anchors.fill: parent
377
+ spacing: 0
378
+
379
+ // tool rail
380
+ Rectangle {
381
+ Layout.fillHeight: true
382
+ Layout.preferredWidth: window.chrome && window.showLeft && !window.empty ? 48 : 0
383
+ visible: Layout.preferredWidth > 0
384
+ clip: true
385
+ color: Theme.header
386
+ Behavior on Layout.preferredWidth { NumberAnimation { duration: Theme.med } }
387
+ Rectangle { anchors.right: parent.right; width: 1; height: parent.height; color: Theme.line }
388
+ Column {
389
+ anchors.horizontalCenter: parent.horizontalCenter
390
+ y: 8; spacing: 3
391
+ IconButton { icon: "cursor"; tip: "Select"; on: viewport.tool === "select"; onHit: viewport.tool = "select" }
392
+ IconButton { icon: "move"; tip: "Move · Ctrl snaps 10 mm, Shift is free"; keys: "W"; on: viewport.tool === "move"; onHit: viewport.tool = "move" }
393
+ IconButton { icon: "ruler"; tip: "Measure · click two points"; keys: "D"; on: viewport.tool === "measure"; onHit: viewport.tool = viewport.tool === "measure" ? "select" : "measure" }
394
+ IconButton { icon: "frame"; tip: "Frame everything"; keys: "H"; onHit: viewport.frameAll(true) }
395
+ Rectangle { width: 26; height: 1; color: Theme.line; anchors.horizontalCenter: parent.horizontalCenter }
396
+ Repeater {
397
+ model: ["box", "cylinder", "sphere", "torus", "capsule", "gear", "helix", "pipe", "loft"]
398
+ delegate: IconButton {
399
+ required property string modelData
400
+ icon: modelData; tip: "Add " + window.byId["add." + modelData].title.toLowerCase()
401
+ onHit: studio.addPrimitive(modelData)
402
+ }
403
+ }
404
+ }
405
+ Column {
406
+ anchors.horizontalCenter: parent.horizontalCenter
407
+ anchors.bottom: parent.bottom; anchors.bottomMargin: 8; spacing: 3
408
+ IconButton { icon: "undo"; tip: "Undo"; keys: "Ctrl+Z"; enabled: studio.canUndo; onHit: studio.undo() }
409
+ IconButton { icon: "redo"; tip: "Redo"; keys: "Ctrl+Shift+Z"; enabled: studio.canRedo; onHit: studio.redo() }
410
+ }
411
+ }
412
+
413
+ // centre: viewport + timeline
414
+ ColumnLayout {
415
+ Layout.fillWidth: true
416
+ Layout.fillHeight: true
417
+ spacing: 0
418
+ Item {
419
+ id: stage
420
+ Layout.fillWidth: true
421
+ Layout.fillHeight: true
422
+ clip: true
423
+ Rectangle { // backdrop: the theme's studio gradient; navy for blueprint; a dark stage for Showcase
424
+ anchors.fill: parent
425
+ gradient: Gradient {
426
+ GradientStop { position: 0.0; color: window.present ? "#ffffff" : window.showcase ? Theme.stageTop : Qt.tint(Theme.viewTop, Qt.rgba(0.03, 0.10, 0.22, window.blueprint * 0.85)) }
427
+ GradientStop { position: 1.0; color: window.present ? "#e6e9ee" : window.showcase ? Theme.stageBottom : Qt.tint(Theme.viewBottom, Qt.rgba(0.01, 0.05, 0.13, window.blueprint * 0.85)) }
428
+ }
429
+ }
430
+ Shape { // soft vignette: pulls the eye to the build
431
+ anchors.fill: parent
432
+ opacity: window.showcase || window.present ? 0 : Theme.dark ? 0.55 : 0.25
433
+ ShapePath {
434
+ strokeColor: "transparent"
435
+ fillGradient: RadialGradient {
436
+ centerX: stage.width / 2; centerY: stage.height * 0.52
437
+ focalX: centerX; focalY: centerY
438
+ centerRadius: Math.max(stage.width, stage.height) * 0.72
439
+ GradientStop { position: 0.0; color: "#00000000" }
440
+ GradientStop { position: 0.55; color: "#00000000" }
441
+ GradientStop { position: 1.0; color: "#d0000000" }
442
+ }
443
+ PathRectangle { x: 0; y: 0; width: stage.width; height: stage.height }
444
+ }
445
+ }
446
+ Viewport {
447
+ id: viewport
448
+ anchors.fill: parent
449
+ blueprint: window.blueprint
450
+ explode: window.explode
451
+ explodeGoal: window.explodeTarget
452
+ avoid: { // the specify capsule, and the explode bar above it when shown
453
+ if (window.empty || dream.hideT > 0.5) return Qt.rect(0, 0, 0, 0)
454
+ if (!showcaseBar.visible) return Qt.rect(dream.x, dream.y, dream.width, dream.height)
455
+ const x0 = Math.min(dream.x, showcaseBar.x), x1 = Math.max(dream.x + dream.width, showcaseBar.x + showcaseBar.width)
456
+ return Qt.rect(x0, showcaseBar.y, x1 - x0, dream.y + dream.height - showcaseBar.y)
457
+ }
458
+ hidden: window.hidden
459
+ isolate: window.isolate
460
+ showcase: window.showcase
461
+ present: window.present
462
+ gridOn: window.showGrid && !window.empty
463
+ referenceOn: window.showReference
464
+ turntable: window.showcase && showcaseBar.spin
465
+ onPicked: (id) => studio.select(id)
466
+ onContextRequested: (id, x, y) => window.openContext(id, x, y)
467
+ onExplodeNudge: (d) => window.explodeTarget = Math.max(0, Math.min(1, window.explodeTarget + d))
468
+ onUserInteracted: if (studio.renderPath !== "") studio.clearRender()
469
+ }
470
+ Callouts {
471
+ anchors.fill: parent
472
+ viewport: viewport
473
+ explode: window.explode
474
+ isolate: window.isolate
475
+ hidden: window.hidden
476
+ keepOutLeft: issuesCard.visible ? issuesCard.y + issuesCard.height : titleCard.visible ? titleCard.y + titleCard.height : 0
477
+ visible: studio.mode === "dissect" || studio.mode === "reverse" || (window.showcase && window.explode > 0.2)
478
+ onChosen: (cid) => { studio.select(cid); window.isolate = window.isolate === cid ? "" : cid }
479
+ }
480
+ Image { // path-traced still, cross-faded over the live view until the camera moves
481
+ anchors.fill: parent
482
+ source: studio.renderPath !== "" ? "file://" + studio.renderPath : ""
483
+ fillMode: Image.PreserveAspectCrop
484
+ opacity: studio.renderPath !== "" ? 1 : 0
485
+ visible: opacity > 0
486
+ Behavior on opacity { NumberAnimation { duration: 700 } }
487
+ Rectangle {
488
+ anchors.left: parent.left; anchors.bottom: parent.bottom; anchors.margins: 16
489
+ width: rl.implicitWidth + 18; height: 24; radius: 12; color: "#c0000000"
490
+ Text { id: rl; anchors.centerIn: parent; text: "CYCLES · PATH TRACED · move the camera to return to live"
491
+ color: "#e0e0e0"; font.pixelSize: 10; font.letterSpacing: 1; font.family: Theme.sans }
492
+ }
493
+ }
494
+
495
+ Rectangle { // blueprint sheet viewer: the A3 PNG over the viewport until closed
496
+ id: sheetView
497
+ anchors.fill: parent
498
+ visible: studio.sheet.png !== undefined
499
+ color: "#e6101418"
500
+ z: 5
501
+ MouseArea { anchors.fill: parent; onClicked: studio.closeSheet() }
502
+ Image {
503
+ anchors.fill: parent; anchors.margins: 28; anchors.bottomMargin: 64
504
+ source: sheetView.visible ? "file://" + studio.sheet.png : ""
505
+ fillMode: Image.PreserveAspectFit; smooth: true; mipmap: true
506
+ cache: false; asynchronous: true
507
+ MouseArea { anchors.centerIn: parent; width: parent.paintedWidth; height: parent.paintedHeight }
508
+ }
509
+ Rectangle {
510
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.bottom: parent.bottom; anchors.bottomMargin: 18
511
+ width: sl.implicitWidth + 22; height: 28; radius: 14; color: "#c0000000"
512
+ Text { id: sl; anchors.centerIn: parent; color: "#e0e0e0"; font.pixelSize: 10; font.letterSpacing: 1; font.family: Theme.sans
513
+ text: "SHEET · " + (studio.sheet.svg || "") + " · click outside or Esc to close" }
514
+ }
515
+ }
516
+
517
+ // ---- floating viewport bar: view, display, overlays
518
+ Rectangle {
519
+ id: viewBar
520
+ visible: !window.showcase && !window.present && !window.empty
521
+ width: vbRow.implicitWidth + 12; height: 36; radius: 18
522
+ color: Theme.glass; border.color: Theme.glassLine
523
+ Row {
524
+ id: vbRow
525
+ anchors.centerIn: parent
526
+ spacing: 4
527
+ Rectangle {
528
+ width: vnRow.implicitWidth + 18; height: 28; radius: 14; anchors.verticalCenter: parent.verticalCenter
529
+ color: viewMenu.visible ? Theme.press : vnMa.containsMouse ? Theme.hover : "transparent"
530
+ Row {
531
+ id: vnRow
532
+ anchors.centerIn: parent; spacing: 5
533
+ Text { text: viewport.viewName; color: Theme.text; font.pixelSize: Theme.fsSmall; font.family: Theme.sans; font.weight: Font.DemiBold }
534
+ Icon { name: "chevronDown"; size: 11; color: Theme.dim; anchors.verticalCenter: parent.verticalCenter }
535
+ }
536
+ MouseArea { id: vnMa; anchors.fill: parent; hoverEnabled: true; onClicked: viewMenu.open() }
537
+ RMenu { id: viewMenu; y: parent.height + 8; implicitWidth: 230
538
+ actions: window.pick(["view.persp", "view.top", "view.right", "view.front", "-", "frameAll", "frameSel"]) }
539
+ }
540
+ Rectangle { width: 1; height: 18; color: Theme.glassLine; anchors.verticalCenter: parent.verticalCenter }
541
+ Repeater {
542
+ model: [ ["shaded", "shaded", "Shaded"], ["lines", "lines", "Shaded with lines"], ["wire", "wire", "Wireframe"], ["xray", "xray", "X-ray"] ]
543
+ delegate: IconButton {
544
+ required property var modelData
545
+ size: 28; iconSize: 15; radius: 14; anchors.verticalCenter: parent.verticalCenter
546
+ icon: modelData[1]; tip: modelData[2]
547
+ on: viewport.displayMode === modelData[0]; onHit: viewport.displayMode = modelData[0]
548
+ }
549
+ }
550
+ Rectangle { width: 1; height: 18; color: Theme.glassLine; anchors.verticalCenter: parent.verticalCenter }
551
+ IconButton { size: 28; iconSize: 15; radius: 14; anchors.verticalCenter: parent.verticalCenter
552
+ icon: "layers"; tip: "Colour by component"; keys: "C"
553
+ on: viewport.colorByComponent; onHit: viewport.colorByComponent = !viewport.colorByComponent }
554
+ IconButton { size: 28; iconSize: 15; radius: 14; anchors.verticalCenter: parent.verticalCenter
555
+ icon: "ruler"; tip: "Blueprint look"; keys: "B"
556
+ on: window.blueprint > 0.5; onHit: bpAnim.go(window.blueprint > 0.5 ? 0 : 1) }
557
+ IconButton { size: 28; iconSize: 15; radius: 14; anchors.verticalCenter: parent.verticalCenter
558
+ icon: "grid"; tip: "Floor grid"; keys: "G"; on: window.showGrid; onHit: window.showGrid = !window.showGrid }
559
+ IconButton { size: 28; iconSize: 15; radius: 14; anchors.verticalCenter: parent.verticalCenter
560
+ visible: studio.reference.length > 0
561
+ icon: "reference"; tip: "Reference images"; keys: "R"
562
+ on: window.showReference; onHit: window.showReference = !window.showReference }
563
+ }
564
+ }
565
+
566
+ // ---- title card
567
+ Column {
568
+ id: titleCard
569
+ x: window.showcase ? 48 : 18; y: window.showcase ? 40 : 60
570
+ visible: !window.empty && !window.present
571
+ Text {
572
+ text: studio.title
573
+ font.family: Theme.sans; font.pixelSize: window.showcase ? 34 : 19; font.weight: Font.DemiBold
574
+ font.letterSpacing: window.showcase ? 0.6 : 0
575
+ color: window.blueprint > 0.5 ? Theme.holo : window.showcase ? "#eef2f7" : Theme.viewText
576
+ }
577
+ Text {
578
+ // narrower on a narrow stage, with a line more, so it stays clear of the centred build
579
+ text: studio.summary; width: window.showcase ? 620 : Math.min(460, Math.max(240, stage.width * 0.36)); wrapMode: Text.WordWrap
580
+ color: window.showcase ? "#aab2bd" : Theme.viewDim; font.pixelSize: window.showcase ? 14 : Theme.fs
581
+ font.family: Theme.sans; lineHeight: 1.25
582
+ maximumLineCount: window.showcase ? 6 : width < 460 ? 3 : 2; elide: Text.ElideRight
583
+ visible: text !== ""
584
+ }
585
+ Row {
586
+ visible: window.showcase
587
+ spacing: 28; topPadding: 14
588
+ Repeater {
589
+ model: [ ["DIMENSIONS", studio.dimensions.length ? studio.dimensions.map(d => Math.round(d)).join(" × ") + " mm" : "—"],
590
+ ["COMPONENTS", studio.components.length], ["BUILD STEPS", studio.stepCount] ]
591
+ delegate: Column {
592
+ required property var modelData
593
+ Text { text: modelData[0]; color: "#6f7782"; font.pixelSize: 10; font.letterSpacing: 2; font.family: Theme.sans }
594
+ Text { text: modelData[1]; color: "#e6e9ee"; font.pixelSize: 16; font.family: Theme.mono }
595
+ }
596
+ }
597
+ }
598
+ }
599
+
600
+ IssuesCard {
601
+ id: issuesCard
602
+ visible: !window.empty && !window.showcase && !window.present && studio.mode !== "reverse"
603
+ x: 18; y: titleCard.y + titleCard.height + 10
604
+ onChosen: (cid) => { studio.select(cid); viewport.frameComponent(cid) }
605
+ }
606
+
607
+ // ---- selection read-out (bottom left)
608
+ Rectangle {
609
+ visible: !window.showcase && !window.present && studio.selected !== "" && viewport.selectedGeo() !== null
610
+ x: 12; y: parent.height - height - 62 // above the prompt bar, which spans the bottom centre
611
+ width: selRow.implicitWidth + 22; height: 30; radius: 15
612
+ color: Theme.glass; border.color: Qt.rgba(Theme.amber.r, Theme.amber.g, Theme.amber.b, 0.5)
613
+ Row {
614
+ id: selRow
615
+ anchors.centerIn: parent; spacing: 12
616
+ readonly property var g: { studio.selected; studio.shapes; return viewport.selectedGeo() }
617
+ Chip { label: "SELECTED"; value: selRow.g ? selRow.g.label : ""; labelColor: Theme.amber }
618
+ Chip { label: "TRIS"; value: selRow.g ? selRow.g.triangles.toLocaleString(Qt.locale(), "f", 0) : "" }
619
+ }
620
+ }
621
+
622
+ // ---- start screen
623
+ Welcome {
624
+ id: welcome
625
+ anchors.fill: parent
626
+ visible: opacity > 0
627
+ opacity: window.empty ? 1 : 0
628
+ Behavior on opacity { NumberAnimation { duration: Theme.slow } }
629
+ onOpenFile: (path) => window.openPath(path)
630
+ onRunAction: (id) => window.byId[id].run()
631
+ }
632
+
633
+ // ---- dissect / showcase bar
634
+ Rectangle {
635
+ id: showcaseBar
636
+ property bool spin: true
637
+ anchors.horizontalCenter: parent.horizontalCenter
638
+ y: (dream.y - height - 10) * (1 - dream.hideT) + (parent.height - height - 26) * dream.hideT
639
+ visible: studio.mode !== "build" && studio.mode !== "present" && !window.empty
640
+ width: sbRow.implicitWidth + 28; height: 42; radius: 21
641
+ color: Theme.glass; border.color: Theme.glassLine
642
+ RowLayout {
643
+ id: sbRow
644
+ anchors.centerIn: parent
645
+ spacing: 10
646
+ Text { text: "Assembled"; color: Theme.dim; font.pixelSize: Theme.fsSmall; font.family: Theme.sans }
647
+ RSlider { implicitWidth: 220; from: 0; to: 1; value: window.explodeTarget; onMoved: window.explodeTarget = value }
648
+ Text { text: "Exploded"; color: Theme.dim; font.pixelSize: Theme.fsSmall; font.family: Theme.sans }
649
+ Rectangle { width: 1; height: 20; color: Theme.glassLine }
650
+ Text { text: "Blueprint"; color: Theme.dim; font.pixelSize: Theme.fsSmall; font.family: Theme.sans; visible: !window.showcase }
651
+ RSlider { visible: !window.showcase; implicitWidth: 110; from: 0; to: 1; value: window.blueprint; onMoved: window.blueprint = value }
652
+ Pill { visible: window.showcase; icon: "spin"; text: showcaseBar.spin ? "Turntable on" : "Turntable off"; onHit: showcaseBar.spin = !showcaseBar.spin }
653
+ Pill {
654
+ visible: window.showcase; icon: "render"
655
+ text: studio.busy.indexOf("Render") === 0 ? "Rendering…" : "Render · Cycles"
656
+ primary: true; enabled: studio.busy === ""
657
+ onHit: { showcaseBar.spin = false; studio.renderShowcase(viewport.cameraJson()) }
658
+ }
659
+ Pill { visible: window.showcase; text: "Exit Esc"; onHit: window.setMode("build") }
660
+ }
661
+ }
662
+
663
+ // ---- the dream capsule: centred on the start screen, docked at the bottom while you work
664
+ Rectangle {
665
+ id: dream
666
+ anchors.horizontalCenter: parent.horizontalCenter
667
+ // two eased factors instead of a Behavior on y: the dock follows layout changes exactly
668
+ property real startT: window.empty ? 1 : 0 // 1 = parked in the start screen
669
+ property real hideT: window.showcase || window.present ? 1 : 0 // 1 = slid out under the stage
670
+ Behavior on startT { NumberAnimation { duration: Theme.slow; easing.type: Easing.OutCubic } }
671
+ Behavior on hideT { NumberAnimation { duration: Theme.med } }
672
+ y: (parent.height - height - 14) * (1 - startT) + welcome.capsuleY * startT + hideT * (height + 40)
673
+ width: Math.min(parent.width - 40, window.empty ? 760 : 860); height: window.empty ? 54 : 46; radius: height / 2
674
+ color: Theme.glass
675
+ border.color: prompt.activeFocus ? Theme.accent : Theme.glassLine
676
+ border.width: prompt.activeFocus ? 1.5 : 1
677
+ Rectangle { // focus glow
678
+ anchors.fill: parent; anchors.margins: -4; radius: height / 2; z: -1
679
+ color: "transparent"; border.width: 4
680
+ border.color: Qt.rgba(Theme.accent.r, Theme.accent.g, Theme.accent.b, prompt.activeFocus ? 0.16 : 0)
681
+ Behavior on border.color { ColorAnimation { duration: Theme.med } }
682
+ }
683
+ RowLayout {
684
+ anchors.fill: parent; anchors.leftMargin: 8; anchors.rightMargin: 8; spacing: 8
685
+ Rectangle {
686
+ id: modeChip
687
+ property bool editMode: false
688
+ readonly property bool edit: editMode && !window.empty
689
+ implicitWidth: mcRow.implicitWidth + 22; implicitHeight: dream.height - 16; radius: height / 2
690
+ color: edit ? Qt.rgba(Theme.amber.r, Theme.amber.g, Theme.amber.b, 0.16) : Theme.accentSoft
691
+ Row {
692
+ id: mcRow
693
+ anchors.centerIn: parent; spacing: 6
694
+ Icon { name: modeChip.edit ? "pencil" : "sparkle"; size: 14; color: modeChip.edit ? Theme.amber : Theme.accentHi
695
+ anchors.verticalCenter: parent.verticalCenter }
696
+ Text { text: modeChip.edit ? "EDIT" : "SPECIFY"; color: modeChip.edit ? Theme.amber : Theme.accentHi
697
+ font.pixelSize: Theme.fsSmall; font.weight: Font.Bold; font.letterSpacing: 1.5; font.family: Theme.sans
698
+ anchors.verticalCenter: parent.verticalCenter }
699
+ }
700
+ MouseArea { anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: modeChip.editMode = !modeChip.editMode }
701
+ ToolTip.visible: false
702
+ }
703
+ TextField {
704
+ id: prompt
705
+ Layout.fillWidth: true
706
+ background: null
707
+ color: Theme.text; font.pixelSize: window.empty ? 15 : 14; font.family: Theme.sans
708
+ placeholderTextColor: Theme.faint
709
+ selectionColor: Theme.accent; selectedTextColor: Theme.onAccent
710
+ placeholderText: modeChip.edit ? "Change it: \"make the reverser doors longer, add a second intake ring\""
711
+ : "Specify it: \"a rocket engine with a regenerative nozzle and turbopumps\""
712
+ enabled: studio.busy === ""
713
+ onAccepted: go()
714
+ function go() {
715
+ if (!text.trim()) return
716
+ if (modeChip.edit) studio.edit(text); else studio.dream(text)
717
+ }
718
+ }
719
+ IconButton { // dictation: press, speak, press again; the words land in the field, Enter sends
720
+ visible: (studio.services.status || {}).stt !== "" && (studio.services.status || {}).stt !== undefined
721
+ icon: "mic"; on: studio.listening
722
+ tip: studio.listening ? "Stop and transcribe" : "Dictate (CPU Whisper)"
723
+ enabled: studio.busy === ""
724
+ onHit: studio.toggleDictation()
725
+ Connections { target: studio; function onDictated(t) { prompt.text = t; prompt.forceActiveFocus() } }
726
+ }
727
+ Pill {
728
+ primary: true; enabled: studio.busy === ""
729
+ implicitHeight: dream.height - 14; implicitWidth: 118
730
+ text: studio.busy !== "" ? "Working…" : modeChip.edit ? "Apply" : "Replicate"
731
+ onHit: prompt.go()
732
+ }
733
+ }
734
+ }
735
+ Presenter {
736
+ id: presenter
737
+ anchors.fill: parent
738
+ window: window
739
+ viewport: viewport
740
+ }
741
+ }
742
+ Timeline {
743
+ id: timeline
744
+ Layout.fillWidth: true
745
+ Layout.preferredHeight: window.chrome && window.showTimeline && !window.empty ? implicitHeight : 0
746
+ visible: Layout.preferredHeight > 0
747
+ clip: true
748
+ Behavior on Layout.preferredHeight { NumberAnimation { duration: Theme.med } }
749
+ }
750
+ }
751
+
752
+ // right: managers / ledger / materials / console
753
+ Rectangle {
754
+ id: rightDock
755
+ Layout.fillHeight: true
756
+ Layout.preferredWidth: window.chrome && window.showRight && !window.empty ? window.rightWidth : 0
757
+ visible: Layout.preferredWidth > 0
758
+ clip: true
759
+ color: Theme.panel
760
+ Behavior on Layout.preferredWidth { enabled: !grip.pressed; NumberAnimation { duration: Theme.med } }
761
+ Rectangle { width: 1; height: parent.height; color: Theme.line }
762
+ MouseArea { // drag the edge to resize the dock
763
+ id: grip
764
+ width: 6; height: parent.height; x: -3; z: 5
765
+ cursorShape: Qt.SizeHorCursor
766
+ hoverEnabled: true
767
+ property real startX: 0
768
+ property real startW: 0
769
+ onPressed: (m) => { startX = mapToItem(null, m.x, 0).x; startW = window.rightWidth }
770
+ onPositionChanged: (m) => { if (pressed) window.rightWidth = Math.max(300, Math.min(620, startW - (mapToItem(null, m.x, 0).x - startX))) }
771
+ Rectangle { anchors.centerIn: parent; width: 2; height: parent.height; color: Theme.accent; opacity: grip.containsMouse || grip.pressed ? 0.7 : 0 }
772
+ }
773
+ SplitView {
774
+ anchors.fill: parent
775
+ anchors.leftMargin: 1
776
+ orientation: Qt.Vertical
777
+ handle: Rectangle {
778
+ implicitHeight: 5; color: SplitHandle.hovered || SplitHandle.pressed ? Theme.accentSoft : Theme.header
779
+ Rectangle { anchors.centerIn: parent; width: 28; height: 2; radius: 1; color: Theme.line }
780
+ }
781
+ ColumnLayout {
782
+ SplitView.preferredHeight: parent.height * (studio.mode === "reverse" ? 0.56 : 0.42)
783
+ SplitView.minimumHeight: 120
784
+ spacing: 0
785
+ DockHeader {
786
+ title: studio.mode === "reverse" ? "Reverse engineering" : "Objects"
787
+ icon: studio.mode === "reverse" ? "reverse" : "layers"
788
+ count: studio.mode === "reverse" ? "" : (studio.components.length ? String(studio.components.length) : "")
789
+ IconButton { size: 26; iconSize: 14; icon: "eye"; tip: "Show everything"
790
+ visible: studio.mode !== "reverse"; onHit: { window.hidden = ({}); window.isolate = "" } }
791
+ }
792
+ HolodeckPanel { Layout.fillWidth: true; visible: studio.mode === "reverse" && studio.holodeckSheets.length > 0 }
793
+ ObjectManager {
794
+ Layout.fillWidth: true; Layout.fillHeight: true
795
+ visible: studio.mode !== "reverse"
796
+ hidden: window.hidden; isolate: window.isolate
797
+ onToggleHidden: (cid) => window.toggleHidden(cid)
798
+ onIsolateComponent: (cid) => window.isolate = cid
799
+ onPlayComponent: (cid) => window.playComponent(cid)
800
+ onContextRequested: (cid, x, y) => window.openContext(cid, x, y)
801
+ }
802
+ LedgerPanel {
803
+ Layout.fillWidth: true; Layout.fillHeight: true
804
+ visible: studio.mode === "reverse"
805
+ onImportRequested: importDlg.open()
806
+ onDisassemble: { window.explodeTarget = 0; timeline.play(-1) }
807
+ }
808
+ }
809
+ ColumnLayout {
810
+ SplitView.fillHeight: true
811
+ spacing: 0
812
+ Rectangle {
813
+ Layout.fillWidth: true; implicitHeight: Theme.bar; color: Theme.header
814
+ Rectangle { anchors.bottom: parent.bottom; width: parent.width; height: 1; color: Theme.line }
815
+ Row {
816
+ x: 4; height: parent.height
817
+ Repeater {
818
+ model: [ [studio.mode === "reverse" ? "Objects" : "Attributes", studio.mode === "reverse" ? "layers" : "sliders"],
819
+ ["Materials", "material"], ["Console", "terminal"] ]
820
+ delegate: Item {
821
+ id: tab
822
+ required property var modelData
823
+ required property int index
824
+ readonly property bool sel: window.rightTab === index
825
+ width: tabRow.implicitWidth + 22; height: parent.height
826
+ Row {
827
+ id: tabRow
828
+ anchors.centerIn: parent; spacing: 6
829
+ Icon { name: tab.modelData[1]; size: 13; color: tab.sel ? Theme.accentHi : Theme.faint; anchors.verticalCenter: parent.verticalCenter }
830
+ Text { text: tab.modelData[0].toUpperCase(); anchors.verticalCenter: parent.verticalCenter
831
+ font.pixelSize: Theme.fsTiny; font.weight: Font.DemiBold; font.letterSpacing: Theme.caps; font.family: Theme.sans
832
+ color: tab.sel ? Theme.text : tabMa.containsMouse ? Theme.text : Theme.dim }
833
+ }
834
+ Rectangle { anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter
835
+ width: parent.width - 12; height: 2; radius: 1; color: tab.sel ? Theme.accent : "transparent" }
836
+ MouseArea { id: tabMa; anchors.fill: parent; hoverEnabled: true; onClicked: window.rightTab = tab.index }
837
+ }
838
+ }
839
+ }
840
+ }
841
+ StackLayout {
842
+ Layout.fillWidth: true; Layout.fillHeight: true
843
+ currentIndex: window.rightTab
844
+ Item {
845
+ AttributeManager { anchors.fill: parent; visible: studio.mode !== "reverse" }
846
+ ObjectManager {
847
+ anchors.fill: parent; visible: studio.mode === "reverse"
848
+ hidden: window.hidden; isolate: window.isolate
849
+ onToggleHidden: (cid) => window.toggleHidden(cid)
850
+ onIsolateComponent: (cid) => window.isolate = cid
851
+ onPlayComponent: (cid) => window.playComponent(cid)
852
+ onContextRequested: (cid, x, y) => window.openContext(cid, x, y)
853
+ }
854
+ }
855
+ MaterialShelf {}
856
+ Rectangle {
857
+ color: Theme.field
858
+ ScrollView {
859
+ anchors.fill: parent
860
+ TextArea {
861
+ readOnly: true; text: studio.log; wrapMode: TextEdit.Wrap
862
+ font.family: Theme.mono; font.pixelSize: Theme.fsTiny; color: Theme.dim
863
+ selectionColor: Theme.accent; selectedTextColor: Theme.onAccent
864
+ background: null
865
+ onTextChanged: cursorPosition = length
866
+ }
867
+ }
868
+ }
869
+ }
870
+ }
871
+ }
872
+ }
873
+ }
874
+ }