Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Merge feat/curve-tube into batch/0.11.15: Tube Part guard folded into deform-panel's canDeform(); Tube ends 'Rounded' (was 'Round', which the Deform Round op already translates as a verb); i18n union
islandmedcb83151afed3
diff --cc docs/guide/tube.mdindex 00000000,47a0f658..80b53deemode 000000,100644..100644--- a/docs/guide/tube.md+++ b/docs/guide/tube.md@@@ -1,0 -1,91 +1,91 @@@+ # Tube: draw in 3D space++ **Tube** draws clay tubes freely in the air, like a 3D pen: horns, vines, hair strands, tentacles, cables, piping+ or the wire of an armature, drawn where you want them instead of pulled out of a surface. Each stroke becomes a+ smooth curve with a tube swept along it, and its points stay editable until you bake it into a mesh to sculpt.++ ++ ## Draw a tube++ 1. Open **Tool > Tube** and press **Draw Tube**.+ 2. Drag anywhere in the view: on the model, off it, or from one into the other. A trail shows the tube as you+ draw; let go and it is made.+ 3. <kbd>Ctrl</kbd>+<kbd>Z</kbd> takes the tube away again.++ While Draw Tube is on, <kbd>Alt</kbd>+drag still moves the view (and so do the right and middle buttons), so you can+ draw, turn the model, and draw again from another side. The brush ring is replaced by a circle as thick as the tube+ will be.++ ++ | Setting | What it does |+ |---|---|+ | **Size** | How thick new tubes are: their radius on screen at the depth you draw at |+ | **Pressure** | How much a light touch of the pen thins the tube (0: the same thickness all along). A mouse draws at full size |+ | **Smoothing** | How much of the stroke's wobble is smoothed out before the tube is made |+ | **Depth** | Where in depth the stroke lies (below) |+ | **Snap to surfaces** | Where the pen is over a surface, the tube lies on it, half sunk in, instead of on the drawing plane |-| **Ends** | **Round** or **Flat** |++| **Ends** | **Rounded** or **Flat** |+ | **Result** | **New Part**: each stroke is a Tube Part you can edit. **Merge**: the stroke goes into the active Part |++ **Symmetry** (<kbd>X</kbd>) draws the mirror copy across the X plane too, and keeps it as you edit the tube.++ ## Depth: where the stroke lies++ A stroke on a flat screen needs a depth. The tube's points lie on a plane facing you:++ - **Surface** (the default): through the surface under the pen where the stroke starts. A stroke that starts off+ the model uses the depth where your last stroke ended, or the pivot. So a stroke started on a head and pulled out+ sideways grows from that spot into the air.+ - **Pivot**: through the view's pivot, the point the camera turns around.+ - **Fixed**: at a set **Distance** from the camera. Orbit and draw again to build up a shape in 3D.++ Turn **Snap to surfaces** on to draw along a model: a strap round an arm, a seam, a vein.++ ## Edit the points++ A Tube Part's control points show as dots joined by a thin line (with Draw Tube on, the dots of every visible Tube+ Part show, and pressing one selects that Part):++ - **Drag** a dot to move it across the screen; the tube follows as you drag.+ - <kbd>Ctrl</kbd>+drag a dot up or right to make the tube thicker there, down or left to make it thinner.+ - <kbd>Alt</kbd>+click a dot to delete it.+ - The dot you last dragged is selected (orange): **Radius** sets its thickness exactly, **Insert Point** adds a+ point halfway to the next one, **Delete Point** removes it.-- **Round** and **Flat** change the ends of the selected tube.++- **Rounded** and **Flat** change the ends of the selected tube.++ Each drag and button is one undo step. A Tube Part isn't sculpted while its points are editable: brushes leave it+ alone until you bake it. If you move, mirror or otherwise change the Part's mesh, its points no longer fit it and+ editing them is refused (undo the change, or bake it as it is).++ ## Bake and Merge++ **Bake** turns the active Tube Part into a plain mesh to sculpt, in quads, with one face group for the body and one+ for each end. Tick **Even edges** first to bake it in triangles of one size instead, ready for+ [dynamic topology](dynamic-topology.md). Undo brings the points back.++ **Result > Merge** skips the Tube Part: each stroke goes straight into the active Part as one undo step, with even+ edges close to that Part's own edge length, so dynamic topology carries on smoothly across it. A Part with+ subdivision levels or a micro level can't take a merged tube; draw a new Part and merge it with the+ [Parts](parts.md) list.++ > **Tip:** for clay-like strands, draw with Merge into a Part with dynamic topology on, then smooth and blend the+ > joins with the brushes.++ ## From a script++ The `tube_*` commands do the same from the Console, scripts and AI assistants:++ ```+ tube_new points="0,0,0 0.5,0.4,0,0.08 1,0.2,0.3" radius=0.05 caps=round symmetry=x+ tube_list+ tube_set_point index=1 position="0.5,0.6,0" radius=0.1+ tube_insert_point index=0+ tube_delete_point index=2+ tube_set caps=flat radius_scale=1.5+ tube_bake uniform=true+ ```++ Each point is `x,y,z` or `x,y,z,radius`. With `smooth=0.5` the points are treated as raw pen samples: smoothed and+ simplified into control points, as a drawn stroke is. `merge=true` puts the tube into the active Part.diff --cc src/app/I18nSimplifiedChinese.cppindex e50fe36e,7f61645e..9f6250cb--- a/src/app/I18nSimplifiedChinese.cpp+++ b/src/app/I18nSimplifiedChinese.cpp@@@ -4419,56 -4376,52 +4419,102 @@@ constexpr Entry kSimplifiedChinese[] ="旋转模板,以逆时针度数表示;Ctrl+点击以输入。"},{"Centre the Stencil again, upright, 80% of the view's height.","将模板重新居中、摆正,高度为视图的 80%。"},+ // Compact bars (@factoberplay)+ {"%zu branch",+ "%zu 个分支"},+ {"%zu branches",+ "%zu 个分支"},+ {"Compact timeline",+ "精简时间轴"},+ {"Drag to make the Library's thumbnails bigger or smaller.",+ "拖动以放大或缩小资源库的缩略图。"},+ {"Fold the header row into the track's row: a thinner strip.",+ "将标题行并入轨道行:更细的条带。"},+ {"Full timeline",+ "完整时间轴"},+ {"Library size",+ "资源库大小"},+ {"Show the timeline with its header row (Preferences > Interface > Compact timeline).",+ "显示带有标题行的时间轴(偏好设置 > 界面 > 精简时间轴)。"},+ {"Size of the Library's thumbnails (64 by default); dragging the strip's edge toward the canvas does the same.",+ "资源库缩略图的大小(默认 64);向画布拖动条带的边缘效果相同。"},+ {"The Sculpt Timeline as one thin row: the step count, the track and icon buttons (the default). Off: the full strip, with a header row above the track. Saved automatically.",+ "雕刻时间轴显示为一条细行:步数、轨道和图标按钮(默认)。关闭:完整条带,轨道上方有标题行。自动保存。"},+ {"Thumbnail size",+ "缩略图大小"},+ {"Thumbnails %.0f px",+ "缩略图 %.0f px"},+ // Membership moments (PanelSupportCard.cpp)+ {"Member", "会员"},+ {"You've opened SculptForge %d times. Members keep it free and growing.",+ "你已打开 SculptForge %d 次。会员让它保持免费并持续成长。"},+ {"You've sculpted %d hours in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中雕刻了 %d 小时。会员让它保持免费并持续成长。"},+ {"You've saved your work %d times in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中保存作品 %d 次。会员让它保持免费并持续成长。"},+ {"Members funded this month: %s.",+ "本月由会员资助:%s。"},+ {"Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.",+ "目前的创始会员:%d / %d。获得徽章、列名于致谢名单,价格永久锁定。"},+ {"%d change in this release was a member's request.",+ "此版本有 %d 项更改来自会员的请求。"},+ {"%d changes in this release were members' requests.",+ "此版本有 %d 项更改来自会员的请求。"},+ {"Thank you for being a member: you keep SculptForge free and growing.",+ "感谢你成为会员:你让 SculptForge 保持免费并持续成长。"},+ {"SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "SculptForge 是免费的开源软件。会员让它保持免费并持续成长(帮助 > 支持 SculptForge)。"},+ // Recent colours (Oslen on Discord)+ {"Recent colour",+ "最近颜色"},+ {"A colour you painted with lately: click to paint with it again.",+ "你最近用过的绘制颜色:点击即可再次使用。"},+ // --- Tube (Tool > Tube, PanelTube.cpp) ---+ {"Delete Point", "删除点"},+ {"Ends", "端部"},+ {"Even edges", "均匀边长"},+ {"Fixed", "固定"},+ {"Insert Point", "插入点"},+ {"Distance %.2f", "距离 %.2f"},+ {"Merge", "合并"},+ {"New Part", "新部件"},+ {"(point %d selected)", "(已选中点 %d)"},+ {"%d points", "%d 个点"},+ {"Pressure %.2f", "压力 %.2f"},+ {"Radius %.4g", "半径 %.4g"},+ {"Draw Tube", "绘制 Tube"},+ {"Result", "结果"},- {"Round", "圆形"},++ {"Rounded", "圆头"},+ {"Select a Tube Part to edit its points.", "选择一个 Tube 部件以编辑它的点。"},+ {"Smoothing %.2f", "平滑 %.2f"},+ {"Snap to surfaces", "吸附到表面"},+ {"Add a point halfway between the selected point and the next one.", "在选中的点和下一个点的正中间添加一个点。"},+ {"Bake re-sweeps the tube in triangles of one size (good for dynamic topology) instead of keeping its quads.",+ "Bake 时用大小一致的三角形重新生成管子(适合动态拓扑),而不是保留四边形。"},+ {"Delete the selected point (the one last dragged, in orange). Alt+click a point does the same.",+ "删除选中的点(最后拖动的那个,橙色)。Alt+点击一个点也可以删除它。"},+ {"Drag anywhere in the view to draw a clay tube in the air, like a 3D pen: on the model or off it. Pen pressure makes it thinner, Symmetry X draws the mirror copy. Alt+drag still moves the view.",+ "在视图中任意位置拖动,像 3D 笔一样在空中画出粘土管子:在模型上或模型外都可以。笔压越轻管子越细,对称 X 会画出镜像副本。Alt+拖动仍然移动视图。"},+ {"Each stroke goes into the active Part, with even edge lengths close to that Part's own, ready for dynamic topology.",+ "每一笔都合并进当前部件,边长均匀并接近该部件自身的边长,适合动态拓扑。"},+ {"Each stroke makes a Tube Part whose points stay editable until Bake.",+ "每一笔生成一个 Tube 部件,它的点在 Bake 之前都可以编辑。"},+ {"Flat ends (for new tubes, and the active Tube Part).", "平面端部(用于新管子和当前的 Tube 部件)。"},+ {"How much a light touch of the pen thins the tube. 0: the same thickness all along.",+ "笔的轻触让管子变细的程度。0:整条粗细相同。"},+ {"How much the stroke's wobble is smoothed out before the tube is made.", "生成管子之前,笔画的抖动被平滑掉的程度。"},+ {"How thick new tubes are, as a radius on screen at the depth you draw at.", "新管子的粗细:在你绘制的深度上,屏幕上的半径。"},+ {"Make the active Tube Part a plain mesh to sculpt. Its points can't be edited after this (undo brings them back).",+ "把当前的 Tube 部件变成普通网格以便雕刻。之后不能再编辑它的点(撤销可以恢复)。"},+ {"Round ends (for new tubes, and the active Tube Part).", "圆形端部(用于新管子和当前的 Tube 部件)。"},+ {"Smoothing", "平滑"},+ {"Strokes are drawn at a fixed distance from the camera (Depth below); orbit to draw at another angle.",+ "笔画画在离相机固定距离的位置(见下方的距离);环绕视图后可以从另一个角度绘制。"},+ {"Strokes are drawn at the depth of the surface under the pen where they start; started off the model, at the depth where the last stroke ended (or the pivot).",+ "笔画画在起笔处笔下表面的深度;如果在模型外起笔,则画在上一笔结束处的深度(或枢轴点)。"},+ {"Strokes are drawn on the plane through the view's pivot, facing you.", "笔画画在穿过视图枢轴点、面向你的平面上。"},+ {"Where the pen is over a surface, the tube lies on it (half sunk in) instead of on the drawing plane.",+ "笔在表面上方时,管子贴在表面上(一半陷入),而不是画在绘制平面上。"},};} // namespacediff --cc src/app/I18nSpanish.cppindex 8c16c9b8,597a0156..0cfb3ba6--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@@ -4897,56 -4854,58 +4897,108 @@@ constexpr Entry kSpanish[] ="Barra superior"},{"Status bar","Barra de estado"},+ // Compact bars (@factoberplay)+ {"%zu branch",+ "%zu rama"},+ {"%zu branches",+ "%zu ramas"},+ {"Compact timeline",+ "Línea de tiempo compacta"},+ {"Drag to make the Library's thumbnails bigger or smaller.",+ "Arrastra para agrandar o achicar las miniaturas de la Biblioteca."},+ {"Fold the header row into the track's row: a thinner strip.",+ "Pliega la fila de cabecera en la fila de la pista: una tira más delgada."},+ {"Full timeline",+ "Línea de tiempo completa"},+ {"Library size",+ "Tamaño de la Biblioteca"},+ {"Show the timeline with its header row (Preferences > Interface > Compact timeline).",+ "Muestra la línea de tiempo con su fila de cabecera (Preferencias > Interfaz > Línea de tiempo compacta)."},+ {"Size of the Library's thumbnails (64 by default); dragging the strip's edge toward the canvas does the same.",+ "Tamaño de las miniaturas de la Biblioteca (64 por defecto); arrastrar el borde de la tira hacia el lienzo hace lo mismo."},+ {"The Sculpt Timeline as one thin row: the step count, the track and icon buttons (the default). Off: the full strip, with a header row above the track. Saved automatically.",+ "La Línea de tiempo de esculpido en una sola fila delgada: el número de pasos, la pista y botones de icono (por defecto). Desactivado: la tira completa, con una fila de cabecera sobre la pista. Se guarda automáticamente."},+ {"Thumbnail size",+ "Tamaño de miniatura"},+ {"Thumbnails %.0f px",+ "Miniaturas %.0f px"},+ // Membership moments (PanelSupportCard.cpp)+ {"Member", "Miembro"},+ {"You've opened SculptForge %d times. Members keep it free and growing.",+ "Has abierto SculptForge %d veces. Los miembros lo mantienen gratis y en crecimiento."},+ {"You've sculpted %d hours in SculptForge. Members keep it free and growing.",+ "Has esculpido %d horas en SculptForge. Los miembros lo mantienen gratis y en crecimiento."},+ {"You've saved your work %d times in SculptForge. Members keep it free and growing.",+ "Has guardado tu trabajo %d veces en SculptForge. Los miembros lo mantienen gratis y en crecimiento."},+ {"Members funded this month: %s.",+ "Financiado por los miembros este mes: %s."},+ {"Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.",+ "Miembros fundadores hasta ahora: %d de %d. Una insignia, tu nombre en los créditos y tu precio fijo para siempre."},+ {"%d change in this release was a member's request.",+ "%d cambio de esta versión fue una petición de un miembro."},+ {"%d changes in this release were members' requests.",+ "%d cambios de esta versión fueron peticiones de miembros."},+ {"Thank you for being a member: you keep SculptForge free and growing.",+ "Gracias por ser miembro: mantienes SculptForge gratis y en crecimiento."},+ {"SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "SculptForge es libre y de código abierto. Los miembros lo mantienen gratis y en crecimiento (Ayuda > Apoya a SculptForge)."},+ // Recent colours (Oslen on Discord)+ {"Recent colour",+ "Color reciente"},+ {"A colour you painted with lately: click to paint with it again.",+ "Un color con el que pintaste hace poco: haz clic para volver a pintar con él."},+ // --- Tube (Tool > Tube, PanelTube.cpp) ---+ {"Delete Point", "Borrar punto"},+ {"Ends", "Extremos"},+ {"Even edges", "Aristas uniformes"},+ {"Fixed", "Fija"},+ {"Insert Point", "Insertar punto"},+ {"Distance %.2f", "Distancia %.2f"},+ {"Merge", "Fusionar"},+ {"New Part", "Nueva pieza"},+ {"(point %d selected)", "(punto %d seleccionado)"},+ {"%d points", "%d puntos"},+ {"Pressure %.2f", "Presión %.2f"},+ {"Radius %.4g", "Radio %.4g"},+ {"Draw Tube", "Dibujar Tube"},+ {"Result", "Resultado"},- {"Round", "Redondo"},++ {"Rounded", "Redondeado"},+ {"Select a Tube Part to edit its points.", "Selecciona una pieza Tube para editar sus puntos."},+ {"Smoothing %.2f", "Suavizado %.2f"},+ {"Snap to surfaces", "Ajustar a superficies"},+ {"Add a point halfway between the selected point and the next one.",+ "Añade un punto a medio camino entre el punto seleccionado y el siguiente."},+ {"Bake re-sweeps the tube in triangles of one size (good for dynamic topology) instead of keeping its quads.",+ "Bake vuelve a generar el tubo en triángulos de un solo tamaño (bueno para la topología dinámica) en lugar de mantener sus cuadriláteros."},+ {"Delete the selected point (the one last dragged, in orange). Alt+click a point does the same.",+ "Borra el punto seleccionado (el último que arrastraste, en naranja). Alt+clic en un punto hace lo mismo."},+ {"Drag anywhere in the view to draw a clay tube in the air, like a 3D pen: on the model or off it. Pen pressure makes it thinner, Symmetry X draws the mirror copy. Alt+drag still moves the view.",+ "Arrastra en cualquier lugar de la vista para dibujar un tubo de arcilla en el aire, como un bolígrafo 3D: sobre el modelo o fuera de él. La presión del lápiz lo hace más fino; Simetría X dibuja la copia reflejada. Alt+arrastrar sigue moviendo la vista."},+ {"Each stroke goes into the active Part, with even edge lengths close to that Part's own, ready for dynamic topology.",+ "Cada trazo entra en la pieza activa, con aristas uniformes cercanas a las de esa pieza, listo para la topología dinámica."},+ {"Each stroke makes a Tube Part whose points stay editable until Bake.",+ "Cada trazo crea una pieza Tube cuyos puntos siguen siendo editables hasta Bake."},+ {"Flat ends (for new tubes, and the active Tube Part).",+ "Extremos planos (para los tubos nuevos y la pieza Tube activa)."},+ {"How much a light touch of the pen thins the tube. 0: the same thickness all along.",+ "Cuánto adelgaza el tubo un toque ligero del lápiz. 0: el mismo grosor en toda su longitud."},+ {"How much the stroke's wobble is smoothed out before the tube is made.",+ "Cuánto se suaviza el temblor del trazo antes de crear el tubo."},+ {"How thick new tubes are, as a radius on screen at the depth you draw at.",+ "El grosor de los tubos nuevos, como radio en pantalla a la profundidad en que dibujas."},+ {"Make the active Tube Part a plain mesh to sculpt. Its points can't be edited after this (undo brings them back).",+ "Convierte la pieza Tube activa en una malla normal para esculpir. Después ya no se pueden editar sus puntos (deshacer los recupera)."},+ {"Round ends (for new tubes, and the active Tube Part).",+ "Extremos redondos (para los tubos nuevos y la pieza Tube activa)."},+ {"Smoothing", "Suavizado"},+ {"Strokes are drawn at a fixed distance from the camera (Depth below); orbit to draw at another angle.",+ "Los trazos se dibujan a una distancia fija de la cámara (Distancia, abajo); orbita para dibujar desde otro ángulo."},+ {"Strokes are drawn at the depth of the surface under the pen where they start; started off the model, at the depth where the last stroke ended (or the pivot).",+ "Los trazos se dibujan a la profundidad de la superficie bajo el lápiz donde empiezan; si empiezan fuera del modelo, a la profundidad donde terminó el último trazo (o la del pivote)."},+ {"Strokes are drawn on the plane through the view's pivot, facing you.",+ "Los trazos se dibujan en el plano que pasa por el pivote de la vista, de cara a ti."},+ {"Where the pen is over a surface, the tube lies on it (half sunk in) instead of on the drawing plane.",+ "Donde el lápiz está sobre una superficie, el tubo se apoya en ella (medio hundido) en lugar de en el plano de dibujo."},};} // namespacediff --cc src/app/I18nTraditionalChinese.cppindex 4d5348fa,42e38834..1784cd35--- a/src/app/I18nTraditionalChinese.cpp+++ b/src/app/I18nTraditionalChinese.cpp@@@ -4417,56 -4374,52 +4417,102 @@@ constexpr Entry kTraditionalChinese[]"旋轉模板,以逆時針度數表示;Ctrl+點擊以輸入。"},{"Centre the Stencil again, upright, 80% of the view's height.","將模板重新置中、擺正,高度為視圖的 80%。"},+ // Compact bars (@factoberplay)+ {"%zu branch",+ "%zu 個分支"},+ {"%zu branches",+ "%zu 個分支"},+ {"Compact timeline",+ "精簡時間軸"},+ {"Drag to make the Library's thumbnails bigger or smaller.",+ "拖曳以放大或縮小資源庫的縮圖。"},+ {"Fold the header row into the track's row: a thinner strip.",+ "將標題列併入軌道列:更細的長條。"},+ {"Full timeline",+ "完整時間軸"},+ {"Library size",+ "資源庫大小"},+ {"Show the timeline with its header row (Preferences > Interface > Compact timeline).",+ "顯示帶有標題列的時間軸(偏好設定 > 界面 > 精簡時間軸)。"},+ {"Size of the Library's thumbnails (64 by default); dragging the strip's edge toward the canvas does the same.",+ "資源庫縮圖的大小(預設 64);朝畫布拖曳長條的邊緣效果相同。"},+ {"The Sculpt Timeline as one thin row: the step count, the track and icon buttons (the default). Off: the full strip, with a header row above the track. Saved automatically.",+ "雕刻時間軸顯示為一條細列:步數、軌道和圖示按鈕(預設)。關閉:完整長條,軌道上方有標題列。自動儲存。"},+ {"Thumbnail size",+ "縮圖大小"},+ {"Thumbnails %.0f px",+ "縮圖 %.0f px"},+ // Membership moments (PanelSupportCard.cpp)+ {"Member", "會員"},+ {"You've opened SculptForge %d times. Members keep it free and growing.",+ "你已開啟 SculptForge %d 次。會員讓它保持免費並持續成長。"},+ {"You've sculpted %d hours in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中雕刻了 %d 小時。會員讓它保持免費並持續成長。"},+ {"You've saved your work %d times in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中儲存作品 %d 次。會員讓它保持免費並持續成長。"},+ {"Members funded this month: %s.",+ "本月由會員資助:%s。"},+ {"Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.",+ "目前的創始會員:%d / %d。獲得徽章、列名於致謝名單,價格永久鎖定。"},+ {"%d change in this release was a member's request.",+ "此版本有 %d 項變更來自會員的請求。"},+ {"%d changes in this release were members' requests.",+ "此版本有 %d 項變更來自會員的請求。"},+ {"Thank you for being a member: you keep SculptForge free and growing.",+ "感謝你成為會員:你讓 SculptForge 保持免費並持續成長。"},+ {"SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "SculptForge 是免費的開源軟體。會員讓它保持免費並持續成長(說明 > 支持 SculptForge)。"},+ // Recent colours (Oslen on Discord)+ {"Recent colour",+ "最近顏色"},+ {"A colour you painted with lately: click to paint with it again.",+ "你最近用過的繪製顏色:點擊即可再次使用。"},+ // --- Tube (Tool > Tube, PanelTube.cpp) ---+ {"Delete Point", "刪除點"},+ {"Ends", "端部"},+ {"Even edges", "均勻邊長"},+ {"Fixed", "固定"},+ {"Insert Point", "插入點"},+ {"Distance %.2f", "距離 %.2f"},+ {"Merge", "合併"},+ {"New Part", "新部件"},+ {"(point %d selected)", "(已選取點 %d)"},+ {"%d points", "%d 個點"},+ {"Pressure %.2f", "壓力 %.2f"},+ {"Radius %.4g", "半徑 %.4g"},+ {"Draw Tube", "繪製 Tube"},+ {"Result", "結果"},- {"Round", "圓形"},++ {"Rounded", "圓頭"},+ {"Select a Tube Part to edit its points.", "選取一個 Tube 部件以編輯它的點。"},+ {"Smoothing %.2f", "平滑 %.2f"},+ {"Snap to surfaces", "吸附到表面"},+ {"Add a point halfway between the selected point and the next one.", "在選取的點和下一個點的正中間新增一個點。"},+ {"Bake re-sweeps the tube in triangles of one size (good for dynamic topology) instead of keeping its quads.",+ "Bake 時用大小一致的三角形重新產生管子(適合動態拓樸),而不是保留四邊形。"},+ {"Delete the selected point (the one last dragged, in orange). Alt+click a point does the same.",+ "刪除選取的點(最後拖曳的那個,橘色)。Alt+點擊一個點也可以刪除它。"},+ {"Drag anywhere in the view to draw a clay tube in the air, like a 3D pen: on the model or off it. Pen pressure makes it thinner, Symmetry X draws the mirror copy. Alt+drag still moves the view.",+ "在視圖中任意位置拖曳,像 3D 筆一樣在空中畫出黏土管子:在模型上或模型外都可以。筆壓越輕管子越細,對稱 X 會畫出鏡像副本。Alt+拖曳仍然移動視圖。"},+ {"Each stroke goes into the active Part, with even edge lengths close to that Part's own, ready for dynamic topology.",+ "每一筆都合併進作用中的部件,邊長均勻並接近該部件本身的邊長,適合動態拓樸。"},+ {"Each stroke makes a Tube Part whose points stay editable until Bake.",+ "每一筆產生一個 Tube 部件,它的點在 Bake 之前都可以編輯。"},+ {"Flat ends (for new tubes, and the active Tube Part).", "平面端部(用於新管子和作用中的 Tube 部件)。"},+ {"How much a light touch of the pen thins the tube. 0: the same thickness all along.",+ "筆的輕觸讓管子變細的程度。0:整條粗細相同。"},+ {"How much the stroke's wobble is smoothed out before the tube is made.", "產生管子之前,筆畫的抖動被平滑掉的程度。"},+ {"How thick new tubes are, as a radius on screen at the depth you draw at.", "新管子的粗細:在你繪製的深度上,螢幕上的半徑。"},+ {"Make the active Tube Part a plain mesh to sculpt. Its points can't be edited after this (undo brings them back).",+ "把作用中的 Tube 部件變成一般網格以便雕刻。之後不能再編輯它的點(復原可以找回)。"},+ {"Round ends (for new tubes, and the active Tube Part).", "圓形端部(用於新管子和作用中的 Tube 部件)。"},+ {"Smoothing", "平滑"},+ {"Strokes are drawn at a fixed distance from the camera (Depth below); orbit to draw at another angle.",+ "筆畫畫在離相機固定距離的位置(見下方的距離);環繞視圖後可以從另一個角度繪製。"},+ {"Strokes are drawn at the depth of the surface under the pen where they start; started off the model, at the depth where the last stroke ended (or the pivot).",+ "筆畫畫在起筆處筆下表面的深度;如果在模型外起筆,則畫在上一筆結束處的深度(或樞紐點)。"},+ {"Strokes are drawn on the plane through the view's pivot, facing you.", "筆畫畫在穿過視圖樞紐點、面向你的平面上。"},+ {"Where the pen is over a surface, the tube lies on it (half sunk in) instead of on the drawing plane.",+ "筆在表面上方時,管子貼在表面上(一半陷入),而不是畫在繪製平面上。"},};} // namespacediff --cc src/app/PanelTube.cppindex 00000000,905ada96..0f504826mode 000000,100644..100644--- a/src/app/PanelTube.cpp+++ b/src/app/PanelTube.cpp@@@ -1,0 -1,392 +1,392 @@@+ // SculptForge - open source digital sculpting+ // SPDX-License-Identifier: GPL-3.0-or-later+ //+ // Tool > Tube and the Tube tool in the viewport (core/Tube.h): draw clay tubes in the air like a 3D pen.+ // Draw Tube on: a left-drag anywhere (on the model or off it) draws a tube. Its points lie on a plane facing the+ // view: through the surface under the pen where the stroke starts (else the last stroke's end, else the pivot),+ // through the pivot, or at a fixed distance from the camera. Snap to surfaces puts points over a surface onto+ // it. Pen pressure thins the tube; the stroke is smoothed and simplified into the curve's control points.+ // The result is a new Tube Part (undo takes it away again) or, with Merge, part of the active Part.+ // A Tube Part's points show as dots: drag one to move it (in the view plane), Ctrl+drag to make the tube thicker+ // or thinner there, Alt+click to delete it. With Draw Tube on, the dots of every visible Tube Part show and a+ // press on one selects that Part. Bake makes the Part a plain mesh to sculpt.+ // Alt+drag still navigates; every stroke and point drag is one undo step. Symmetry X draws the mirror copy too.+ #include "app/App.h"+ #include "app/Demo.h"+ #include "app/Palettes.h"+ #include "app/Theme.h"+ #include "app/Ui.h"++ #include "core/Tube.h"++ #include <algorithm>+ #include <cmath>++ namespace sf {++ namespace {++ constexpr const char* kTubePath = "Tool > Tube";++ bool ctrlDown(SDL_Keymod mod) { return (mod & (SDL_KMOD_CTRL | SDL_KMOD_GUI)) != 0; } // as App.cpp++ glm::vec3 planeHit(const glm::vec3& o, const glm::vec3& d, const glm::vec3& p, const glm::vec3& n) {+ const float dn = glm::dot(d, n);+ const float t = std::abs(dn) > 1e-12f ? glm::dot(p - o, n) / dn : 0.0f;+ return o + d * std::max(t, 0.0f);+ }++ } // namespace++ void App::registerTubeUiActions() {+ auto add = [this](const char* id, const char* label, std::function<void()> run, std::function<bool()> enabled,+ std::function<bool()> checked, const char* description, const char* command = "") {+ Action a;+ a.id = id;+ a.label = label;+ a.palette = kTubePath;+ a.run = std::move(run);+ a.enabled = std::move(enabled);+ a.checked = std::move(checked);+ a.description = description;+ a.command = command;+ actions_.add(std::move(a));+ };+ add("tube.draw", "Draw Tube",+ [this] {+ tubeDraw_ = !tubeDraw_;+ status_ = tubeDraw_ ? "Tube: drag anywhere to draw a tube in the air (Alt+drag moves the view)"+ : "Tube: Draw Tube off";+ },+ nullptr, [this] { return tubeDraw_; },+ "Drag anywhere in the view to draw a clay tube in the air, like a 3D pen: on the model or off it. Pen "+ "pressure makes it thinner, Symmetry X draws the mirror copy. Alt+drag still moves the view.");+ const auto depth = [this](TubeDepth d) {+ return [this, d] {+ tubeDepth_ = d;+ if (d == TubeDepth::Fixed && tubeFixedDepth_ <= 0.0f) tubeFixedDepth_ = glm::distance(camera_.position(), camera_.target);+ };+ };+ add("tube.depth_surface", "Surface", depth(TubeDepth::Surface), nullptr, [this] { return tubeDepth_ == TubeDepth::Surface; },+ "Strokes are drawn at the depth of the surface under the pen where they start; started off the model, at "+ "the depth where the last stroke ended (or the pivot).");+ add("tube.depth_pivot", "Pivot", depth(TubeDepth::Pivot), nullptr, [this] { return tubeDepth_ == TubeDepth::Pivot; },+ "Strokes are drawn on the plane through the view's pivot, facing you.");+ add("tube.depth_fixed", "Fixed", depth(TubeDepth::Fixed), nullptr, [this] { return tubeDepth_ == TubeDepth::Fixed; },+ "Strokes are drawn at a fixed distance from the camera (Depth below); orbit to draw at another angle.");+ add("tube.snap", "Snap to surfaces", [this] { tubeSnap_ = !tubeSnap_; }, nullptr, [this] { return tubeSnap_; },+ "Where the pen is over a surface, the tube lies on it (half sunk in) instead of on the drawing plane.");- add("tube.caps_round", "Round", [this] { tubeFlatCaps_ = false; if (tubeActive()) runCommand("tube_set", {{"caps", std::string("round")}}); },++ add("tube.caps_round", "Rounded", [this] { tubeFlatCaps_ = false; if (tubeActive()) runCommand("tube_set", {{"caps", std::string("round")}}); },+ nullptr, [this] { return tubeActive() ? !doc_.mesh.tube.flatCaps : !tubeFlatCaps_; },+ "Round ends (for new tubes, and the active Tube Part).", "tube_set");+ add("tube.caps_flat", "Flat", [this] { tubeFlatCaps_ = true; if (tubeActive()) runCommand("tube_set", {{"caps", std::string("flat")}}); },+ nullptr, [this] { return tubeActive() ? doc_.mesh.tube.flatCaps : tubeFlatCaps_; },+ "Flat ends (for new tubes, and the active Tube Part).", "tube_set");+ add("tube.new_part", "New Part", [this] { tubeMerge_ = false; }, nullptr, [this] { return !tubeMerge_; },+ "Each stroke makes a Tube Part whose points stay editable until Bake.");+ add("tube.merge", "Merge", [this] { tubeMerge_ = true; }, nullptr, [this] { return tubeMerge_; },+ "Each stroke goes into the active Part, with even edge lengths close to that Part's own, ready for dynamic "+ "topology.");+ const auto selected = [this] { return tubeSelection() >= 0; };+ add("tube.delete_point", "Delete Point",+ [this] { if (const int i = tubeSelection(); i >= 0) runCommand("tube_delete_point", {{"index", double(i)}}); tubeSelected_ = -1; },+ selected, nullptr, "Delete the selected point (the one last dragged, in orange). Alt+click a point does the same.",+ "tube_delete_point");+ add("tube.insert_point", "Insert Point",+ [this] {+ const int i = tubeSelection();+ if (i < 0) return;+ const int at = size_t(i) + 1 < doc_.mesh.tube.points.size() ? i : i - 1;+ if (at >= 0) runCommand("tube_insert_point", {{"index", double(at)}});+ tubeSelected_ = at + 1;+ },+ selected, nullptr, "Add a point halfway between the selected point and the next one.", "tube_insert_point");+ add("tube.bake", "Bake",+ [this] {+ runCommand("tube_bake", {{"uniform", tubeBakeUniform_}});+ tubeSelected_ = -1;+ },+ [this] { return tubeActive(); }, nullptr,+ "Make the active Tube Part a plain mesh to sculpt. Its points can't be edited after this (undo brings them "+ "back).",+ "tube_bake");+ }++ void App::drawTubeContents() {+ const ImGuiStyle& style = ImGui::GetStyle();+ const float full = ImGui::GetContentRegionAvail().x;+ ui::ActionButton(*this, "tube.draw", ImVec2(full, 0));+ tray::GroupLabel(*this, "Stroke");+ ImGui::SetNextItemWidth(full);+ ui::SliderInside("##tubesize", &tubeSizePx_, 2.0f, 120.0f, tr("Size %.0f"));+ ui::HelpText("Size", nullptr, "How thick new tubes are, as a radius on screen at the depth you draw at.", kTubePath);+ ImGui::SetNextItemWidth(full);+ ui::SliderInside("##tubepressure", &tubePressure_, 0.0f, 1.0f, tr("Pressure %.2f"));+ ui::HelpText("Pressure", nullptr, "How much a light touch of the pen thins the tube. 0: the same thickness all along.",+ kTubePath);+ ImGui::SetNextItemWidth(full);+ ui::SliderInside("##tubesmooth", &tubeSmoothing_, 0.0f, 1.0f, tr("Smoothing %.2f"));+ ui::HelpText("Smoothing", nullptr, "How much the stroke's wobble is smoothed out before the tube is made.", kTubePath);+ ImGui::AlignTextToFramePadding();+ ImGui::TextDisabled("%s", tr("Depth"));+ ImGui::SameLine();+ ui::Segmented(*this, {"tube.depth_surface", "tube.depth_pivot", "tube.depth_fixed"});+ if (tubeDepth_ == TubeDepth::Fixed) {+ const float far = std::max(10.0f * glm::distance(camera_.position(), camera_.target), 1.0f);+ ImGui::SetNextItemWidth(full);+ ui::SliderInside("##tubedepth", &tubeFixedDepth_, 0.0f, far, tr("Distance %.2f"));+ }+ ui::ActionButton(*this, "tube.snap", ImVec2(full, 0));+ ImGui::AlignTextToFramePadding();+ ImGui::TextDisabled("%s", tr("Ends"));+ ImGui::SameLine();+ ui::Segmented(*this, {"tube.caps_round", "tube.caps_flat"});+ ImGui::AlignTextToFramePadding();+ ImGui::TextDisabled("%s", tr("Result"));+ ImGui::SameLine();+ ui::Segmented(*this, {"tube.new_part", "tube.merge"});+ if (!tubeActive()) {+ ImGui::PushTextWrapPos(0.0f);+ ImGui::TextDisabled("%s", tr("Select a Tube Part to edit its points."));+ ImGui::PopTextWrapPos();+ return;+ }+ tray::GroupLabel(*this, "Edit");+ const TubeShape& t = doc_.mesh.tube;+ ImGui::TextDisabled(tr("%d points"), int(t.points.size()));+ if (const int sel = tubeSelection(); sel >= 0) {+ ImGui::SameLine();+ ImGui::TextDisabled(tr("(point %d selected)"), sel);+ // (applied as one undo step when the slider is let go)+ const float stored = t.points[size_t(sel)].radius;+ float r = tubeRadiusEdit_ > 0.0f && tubeRadiusEditPoint_ == sel ? tubeRadiusEdit_ : stored;+ ImGui::SetNextItemWidth(full);+ if (ui::SliderInside("##tubepointr", &r, 0.0f, 4.0f * stored, tr("Radius %.4g")) && r > 0.0f) {+ tubeRadiusEdit_ = r;+ tubeRadiusEditPoint_ = sel;+ }+ if (ImGui::IsItemDeactivatedAfterEdit() && tubeRadiusEdit_ > 0.0f) {+ runCommand("tube_set_point", {{"index", double(sel)}, {"radius", double(tubeRadiusEdit_)}});+ tubeRadiusEdit_ = -1.0f;+ }+ }+ const float half = (full - style.ItemSpacing.x) * 0.5f;+ ui::ActionButton(*this, "tube.delete_point", ImVec2(half, 0));+ ImGui::SameLine();+ ui::ActionButton(*this, "tube.insert_point", ImVec2(-1, 0));+ ui::ActionButton(*this, "tube.bake", ImVec2(half, 0));+ ImGui::SameLine();+ ui::Checkbox(tr("Even edges##tube_bake_uniform"), &tubeBakeUniform_);+ ui::HelpText("Even edges", nullptr,+ "Bake re-sweeps the tube in triangles of one size (good for dynamic topology) instead of keeping its quads.",+ kTubePath);+ }++ glm::vec3 App::tubeViewDir() const { return glm::normalize(camera_.target - camera_.position()); }++ int App::tubeSelection() const {+ return tubeActive() && tubeSelected_ >= 0 && size_t(tubeSelected_) < doc_.mesh.tube.points.size() ? tubeSelected_ : -1;+ }++ int App::tubePointAt(float x, float y, int* part) const {+ const float reach = 9.0f * uiScale_;+ float best = reach * reach;+ int found = -1;+ for (int i = 0; i < doc_.partCount(); ++i) {+ if (i != doc_.activePart && !tubeDraw_) continue; // other Tube Parts' points show while drawing+ if (!doc_.parts[size_t(i)].visible) continue;+ const TubeShape& t = doc_.partMesh(i).tube;+ for (size_t k = 0; k < t.points.size(); ++k) {+ ImVec2 s;+ if (!gizmoProject(t.points[k].position, s)) continue;+ const float d2 = (s.x - x) * (s.x - x) + (s.y - y) * (s.y - y);+ if (d2 < best || (d2 == best && i == doc_.activePart)) {+ best = d2;+ found = int(k);+ if (part) *part = i;+ }+ }+ }+ return found;+ }++ bool App::tubeMouseDown(float x, float y, SDL_Keymod mod) {+ const SDL_Keymod keys = SDL_GetModState(); // the keyboard itself+ int part = -1;+ const int point = (tubeActive() || tubeDraw_) ? tubePointAt(x, y, &part) : -1;+ TubeDrag& d = tubeDrag_;+ if (point >= 0) {+ if (part != doc_.activePart) {+ runCommand("part_select", {{"index", double(part)}});+ partSelected("tube point");+ }+ if (!tubeMatchesMesh(doc_.mesh)) {+ status_ = "Tube: this Part was moved or changed since it was drawn; Bake keeps it as it is (or undo the change)";+ return true;+ }+ if (keys & SDL_KMOD_ALT) {+ if (doc_.mesh.tube.points.size() > 1) runCommand("tube_delete_point", {{"index", double(point)}});+ else status_ = "Tube: the last point stays (delete the Part instead)";+ tubeSelected_ = -1;+ return true;+ }+ d = {};+ d.point = point;+ d.resize = ctrlDown(mod);+ d.start = doc_.mesh.tube;+ d.before = doc_.mesh;+ d.x = x;+ d.y = y;+ glm::vec3 o, dir;+ canvasRay(x, y, o, dir);+ const glm::vec3 c = d.start.points[size_t(point)].position;+ d.grab = c - planeHit(o, dir, c, tubeViewDir());+ tubeSelected_ = point;+ drag_ = Drag::Tube;+ return true;+ }+ if (tubeDraw_) {+ if (keys & SDL_KMOD_ALT) return false; // navigates+ d = {};+ d.drawing = true;+ d.planeNormal = tubeViewDir();+ RayHit hit;+ const glm::vec3 eye = camera_.position();+ if (tubeDepth_ == TubeDepth::Fixed) {+ if (tubeFixedDepth_ <= 0.0f) tubeFixedDepth_ = glm::distance(eye, camera_.target);+ d.planePoint = eye + d.planeNormal * tubeFixedDepth_;+ } else if (tubeDepth_ == TubeDepth::Surface && pickPart(x, y, &hit) >= 0) {+ d.planePoint = hit.position;+ } else if (tubeDepth_ == TubeDepth::Surface && tubeHaveAnchor_ && glm::dot(tubeAnchor_ - eye, d.planeNormal) > 0.0f) {+ d.planePoint = tubeAnchor_;+ } else {+ d.planePoint = camera_.target;+ }+ const float wpp = worldPerPixel(d.planePoint);+ d.radius = std::max(tubeSizePx_ * (wpp > 0.0f ? wpp : 0.01f), 1e-5f);+ d.x = x;+ d.y = y;+ drag_ = Drag::Tube;+ tubeDragTo(x, y);+ return true;+ }+ if (tubeActive()) { // a Tube Part isn't sculpted until it is baked+ RayHit hit;+ if (!pick(x, y, hit)) return false; // the background navigates+ status_ = "Tube: drag a point to move it (Ctrl: thickness, Alt+click: delete); Bake to sculpt this Part";+ return true;+ }+ return false;+ }++ void App::tubeDragTo(float x, float y) {+ TubeDrag& d = tubeDrag_;+ glm::vec3 o, dir;+ canvasRay(x, y, o, dir);+ if (d.drawing) {+ const float pressure = std::clamp(strokePressure(), 0.0f, 1.0f);+ const float r = d.radius * (1.0f - tubePressure_ + tubePressure_ * std::max(pressure, 0.05f));+ glm::vec3 p = planeHit(o, dir, d.planePoint, d.planeNormal);+ RayHit hit;+ if (tubeSnap_ && pickPart(x, y, &hit) >= 0) p = hit.position + glm::normalize(hit.normal) * (0.5f * r);+ if (!d.samples.empty() && glm::distance(d.samples.back().position, p) < 0.1f * r) return;+ d.samples.push_back({p, r});+ const float wpp = worldPerPixel(p);+ d.screen.push_back(ImVec4(x, y, wpp > 0.0f ? r / wpp : tubeSizePx_, 0.0f));+ return;+ }+ if (d.point < 0) return;+ TubeShape s = d.start;+ TubePoint& p = s.points[size_t(d.point)];+ if (d.resize) {+ const float amount = ((x - d.x) - (y - d.y)) / (120.0f * uiScale_);+ p.radius = std::max(d.start.points[size_t(d.point)].radius * std::exp(amount), 1e-5f);+ status_ = "Tube: point " + std::to_string(d.point) + " radius " + std::to_string(p.radius).substr(0, 6);+ } else {+ p.position = planeHit(o, dir, p.position, tubeViewDir()) + d.grab;+ }+ doc_.mesh = tubeMesh(s, kTubePreviewTriangles); // (coarser while dragging a long or thin tube)+ doc_.mesh.topologyDirty = true;+ doc_.bvhDirty = true; // (built once when let go)+ tubeDrag_.preview = s;+ d.changed = true;+ }++ void App::tubeRelease() {+ TubeDrag& d = tubeDrag_;+ if (d.drawing) {+ TubeShape s;+ s.points = tubeFromStroke(d.samples, tubeSmoothing_);+ s.flatCaps = tubeFlatCaps_;+ s.mirrorX = symmetry_.x;+ if (!s.points.empty()) {+ int edited = -1;+ const CommandResult r = tubeAdd(doc_, s, tubeMerge_, "Tube", &edited);+ status_ = r.message;+ if (r.ok) {+ tubeAnchor_ = s.points.back().position;+ tubeHaveAnchor_ = true;+ }+ }+ } else if (d.changed) {+ doc_.mesh = std::move(d.before);+ doc_.replaceMeshUndoable(tubeMesh(d.preview), d.resize ? "Tube point size" : "Tube point"); // (full density)+ status_ = std::string("Tube: ") + (d.resize ? "point size" : "point moved") + "; " ++ std::to_string(doc_.mesh.tube.points.size()) + " points";+ }+ d = {};+ }++ void App::drawTubeOverlay() {+ const CanvasRect cr = canvasRect();+ ImDrawList* dl = ImGui::GetBackgroundDrawList();+ const float s = uiScale_;+ dl->PushClipRect(ImVec2(cr.x, cr.y), ImVec2(cr.x + cr.w, cr.y + cr.h), true);+ const TubeDrag& d = tubeDrag_;+ if (drag_ == Drag::Tube && d.drawing) { // the trail: the tube's silhouette as the pen moves+ const ImU32 fill = IM_COL32(205, 170, 140, 150), edge = theme::u32(theme::accent);+ for (const ImVec4& p : d.screen) dl->AddCircleFilled(ImVec2(p.x, p.y), std::max(p.z, 1.0f), fill, 20);+ for (size_t i = 1; i < d.screen.size(); ++i)+ dl->AddLine(ImVec2(d.screen[i - 1].x, d.screen[i - 1].y), ImVec2(d.screen[i].x, d.screen[i].y), edge, 1.5f * s);+ dl->PopClipRect();+ return;+ }+ // The control points of the active Tube Part (and, while drawing tubes, of every visible one).+ const bool hoverOk = !ImGui::GetIO().WantCaptureMouse && cr.contains(mouseX_, mouseY_) && drag_ == Drag::None;+ int hoverPart = -1;+ const int hover = hoverOk ? tubePointAt(mouseX_, mouseY_, &hoverPart) : -1;+ for (int i = 0; i < doc_.partCount(); ++i) {+ if ((i != doc_.activePart && !tubeDraw_) || !doc_.parts[size_t(i)].visible) continue;+ const TubeShape& t = doc_.partMesh(i).tube;+ const bool active = i == doc_.activePart;+ ImVec2 prev;+ bool havePrev = false;+ for (size_t k = 0; k < t.points.size(); ++k) {+ ImVec2 p;+ if (!gizmoProject(t.points[k].position, p)) {+ havePrev = false;+ continue;+ }+ if (havePrev) dl->AddLine(prev, p, IM_COL32(120, 200, 255, active ? 110 : 60), 1.0f * s);+ prev = p;+ havePrev = true;+ }+ for (size_t k = 0; k < t.points.size(); ++k) {+ ImVec2 p;+ if (!gizmoProject(t.points[k].position, p)) continue;+ const bool sel = active && int(k) == tubeSelection();+ const bool hot = int(k) == hover && i == hoverPart;+ const ImU32 col = hot ? ((inputMods() & SDL_KMOD_ALT) ? IM_COL32(255, 90, 80, 240) : IM_COL32(120, 200, 255, 240))+ : sel ? IM_COL32(255, 170, 60, 240)+ : IM_COL32(235, 235, 235, active ? 220 : 120);+ dl->AddCircleFilled(p, (hot || sel ? 4.5f : 3.5f) * s, col, 12);+ dl->AddCircle(p, (hot || sel ? 4.5f : 3.5f) * s, IM_COL32(20, 20, 20, 200), 12, 1.0f * s);+ }+ }+ // Draw Tube's cursor: how thick the tube will be.+ if (tubeDraw_ && hoverOk && hover < 0)+ dl->AddCircle(ImVec2(mouseX_, mouseY_), tubeSizePx_, theme::u32(theme::accent), 32, 1.5f * s);+ dl->PopClipRect();+ }++ } // namespace sfdiff --cc src/core/Deform.cppindex 30805e01,6864af7a..50a43541--- a/src/core/Deform.cpp+++ b/src/core/Deform.cpp@@@ -565,25 -188,30 +565,26 @@@ std::vector<vec3> deformStackPositions(}size_t deformActivePart(Document& doc, DeformOp op, const DeformOptions& o, std::string& error) {+ return deformActivePart(doc, {DeformStep{op, o}}, error, deformName(op));+}++namespace {++// Why the active Part can't be deformed now ("" when it can).+bool canDeform(Document& doc, const std::string& name, std::string& error) {+ const Mesh& mesh = doc.mesh;+ if (doc.sculptor.strokeActive()) error = name + ": finish the stroke first";+ else if (mesh.vertexCount() == 0 || mesh.triangleCount() == 0) error = name + ": the active Part is empty";+ else if (!mesh.forgespheres.empty()) error = name + ": the active Part is a Forge Sphere Part (Make Mesh first)";++ else if (!mesh.tube.empty()) error = name + ": the active Part is a Tube Part (Bake it first)";+ else if (mesh.micro) error = name + ": the active Part has a micro level (Bake Micro or Delete Micro first)";+ else return true;+ return false;+}++// Moves the active Part's vertices to P through the Sculptor as one undo step labelled `name`.+size_t commitPositions(Document& doc, const std::vector<vec3>& P, const std::string& name, bool masked, std::string& error) {Mesh& mesh = doc.mesh;- const std::string name = deformName(op);- if (doc.sculptor.strokeActive()) {- error = name + ": finish the stroke first";- return 0;- }- if (mesh.vertexCount() == 0 || mesh.triangleCount() == 0) {- error = name + ": the active Part is empty";- return 0;- }- if (!mesh.forgespheres.empty()) {- error = name + ": the active Part is a Forge Sphere Part (Make Mesh first)";- return 0;- }- if (!mesh.tube.empty()) {- error = name + ": the active Part is a Tube Part (Bake it first)";- return 0;- }- if (mesh.micro) {- error = name + ": the active Part has a micro level (Bake Micro or Delete Micro first)";- return 0;- }- doc.syncBvh();- const std::vector<vec3> P = deformPositions(mesh, op, o);std::vector<uint32_t> verts;std::vector<vec3> d;for (uint32_t v = 0; v < mesh.vertexCount(); ++v) {