Add-ons: Smart Pen — draw and edit paths with one tool, panel

A built-in add-on under Object › Plug-ins › Smart Pen:
- The Smart Pen Tool draws and edits Bézier paths without switching
  tools: a click adds the next segment straight or curved (a panel
  toggle; Tab flips the segment being placed or the last one), a drag
  makes a smooth point (Alt breaks the handle, Shift snaps to 45°, Space
  moves the point), a curve after a straight segment joins it tangent.
- On existing paths it selects and moves points, removes a point keeping
  the shape (Alt-click), toggles smooth/corner (double-click), drags
  handles, reshapes a segment by dragging it and inserts a point on it
  (Alt-click); it closes, continues and joins open paths.
- The Smart Pen panel: next segment straight or curved, remove points
  keeping shape, make smooth, make corner, retract handles, close or
  join.

The tool stays out of both toolbars as shipped; the All Tools drawer
lists it under the add-on's heading. Commands are addon.pen.*; the
existing Pen tool, commands and menus are unchanged.
This commit is contained in:
bflatastic
2026-10-30 16:02:27 +07:00
parent e85e149384
commit 1ca3db1b51
55 changed files with 2767 additions and 38 deletions
+2 -2
View File
@@ -430,7 +430,7 @@ fn edit_anchors(s: &mut Session, label: &str, cmd: &str, f: impl Fn(&mut SubPath
}
/// A smoothing `ratio` param (default [`pt::SMOOTH_RATIO`]).
fn ratio(p: &Value, cmd: &str) -> Result<f64> {
pub(super) fn ratio(p: &Value, cmd: &str) -> Result<f64> {
let r = number_or(p, "ratio", pt::SMOOTH_RATIO, cmd)?;
let (lo, hi) = pt::SMOOTH_RATIO_RANGE;
if !(lo..=hi).contains(&r) {
@@ -575,7 +575,7 @@ fn add_points(s: &mut Session, p: &Value) -> Result<Value> {
Ok(json!({ "added": added }))
}
fn close(s: &mut Session, p: &Value) -> Result<Value> {
pub(super) fn close(s: &mut Session, p: &Value) -> Result<Value> {
const C: &str = "addon.pathtools.close";
let mode = match text_param(p, "mode", C)? {
None => pt::CloseMode::Handles,