diff --git a/tools/web/check-outliner-headed.mjs b/tools/web/check-outliner-headed.mjs index a6673f719..e969f01f0 100644 --- a/tools/web/check-outliner-headed.mjs +++ b/tools/web/check-outliner-headed.mjs @@ -19,7 +19,7 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; const REPO_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); -const EXPECTED_CASES = ["outliner-tree-baseline-web", "outliner-tools-baseline-web", "outliner-mirror-baseline-web", "outliner-metrics-web", "outliner-display-mode-web", "outliner-filter-web", "outliner-restrict-web", "outliner-select-keys-web", "outliner-delete-web", "outliner-box-select-web", "outliner-id-operation-web", "outliner-id-clipboard-web", "outliner-collection-delete-web", "outliner-mode-dot-web", "outliner-rename-bone-web"]; +const EXPECTED_CASES = ["outliner-tree-baseline-web", "outliner-tools-baseline-web", "outliner-mirror-baseline-web", "outliner-metrics-web", "outliner-display-mode-web", "outliner-filter-web", "outliner-restrict-web", "outliner-select-keys-web", "outliner-delete-web", "outliner-box-select-web", "outliner-id-operation-web", "outliner-id-clipboard-web", "outliner-collection-delete-web", "outliner-mode-dot-web", "outliner-rename-bone-web", "outliner-eyedropper-web"]; /* Desktop Layout geometry the metrics case must reproduce (batch 2: UI sizes). */ const GEOMETRY_GOLDEN = path.join(REPO_ROOT, "tests/golden/OUTLINER-DESKTOP-METRICS/outliner-metrics.json"); const errors = []; diff --git a/tools/web/run-outliner-headed.mjs b/tools/web/run-outliner-headed.mjs index efdc436b5..83912fa64 100644 --- a/tools/web/run-outliner-headed.mjs +++ b/tools/web/run-outliner-headed.mjs @@ -46,6 +46,7 @@ const KNOWN_CASES = [ { id: "outliner-collection-delete-web", title: /\[outliner-collection-delete-web\]/ }, { id: "outliner-mode-dot-web", title: /\[outliner-mode-dot-web\]/ }, { id: "outliner-rename-bone-web", title: /\[outliner-rename-bone-web\]/ }, + { id: "outliner-eyedropper-web", title: /\[outliner-eyedropper-web\]/ }, ]; function usage() { diff --git a/web/app/src/app/App.tsx b/web/app/src/app/App.tsx index c93542a05..87b5e73b5 100644 --- a/web/app/src/app/App.tsx +++ b/web/app/src/app/App.tsx @@ -1,4 +1,5 @@ import { ModifierParameterField } from "./ModifierParameterField"; +import { acceptOutlinerPick, cancelOutlinerPick, useOutlinerPickActive } from "./outliner-pick"; import { Fragment } from 'react'; import { NLA_OBJECT_ID_TYPE } from '../../../protocol/nla'; import { EDITOR_RESOURCE_MAX_BYTES, isEditorResourcePath, modelResourcePath } from '../../../protocol/editor-resource-path'; @@ -2611,6 +2612,18 @@ function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, o const nativeArea = workspace?.areas.find(item => item.editor === 'OUTLINER' && (!areaId || item.id === areaId) && item.regions.some(region => region.kind === 'MAIN' && region.visible)); const tree = nativeArea?.space?.outliner; + /* Desktop ui_eyedropper_id arms a pick that ED_outliner_give_base_under_cursor + * resolves against the row under the cursor; here the pick rides a store so + * the Properties field and this tree share it. */ + const outlinerPickActive = useOutlinerPickActive(); + useEffect(() => { + if (!outlinerPickActive) return; + const onKey = (event: KeyboardEvent) => { + if (event.key === 'Escape') { event.preventDefault(); cancelOutlinerPick(); } + }; + window.addEventListener('keydown', onKey, true); + return () => window.removeEventListener('keydown', onKey, true); + }, [outlinerPickActive]); /* Desktop SO_MODE_COLUMN (outliner_draw.cc): Scenes and View Layer draw a * mode dot on object rows sharing the active object's type while the active * object is in an interaction mode. */ @@ -2862,7 +2875,7 @@ function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, o * parent (default view requires Shift); Alt clears completely instead of * keeping the world transform. Drops on a row are handled there and never * reach this container. */} -
{ /* Only empty space or a B-armed press starts a box; presses on a row * stay with the row (selection, rename, drag-drop). */ @@ -3012,6 +3025,13 @@ function Outliner({ snapshot, areaId, onSelect, onToggleVisibility, onRefresh, o if (onTreeSelect && nativeArea) onTreeSelect(row.id, row.selected, false, nativeArea.id, false); }} onClick={event => { + /* An armed datablock pick takes the base under the cursor instead + * of selecting the row (desktop eyedropper over the Outliner). */ + if (outlinerPickActive && row.objectId) { + event.preventDefault(); event.stopPropagation(); + acceptOutlinerPick(row.objectId); + return; + } const activatesData = event.target instanceof Element && !!event.target.closest('.tree-node-name'); // Name activation follows the same native intent as the diff --git a/web/app/src/app/ModifierParameterField.css b/web/app/src/app/ModifierParameterField.css index 1da3f4189..6c51a9547 100644 --- a/web/app/src/app/ModifierParameterField.css +++ b/web/app/src/app/ModifierParameterField.css @@ -65,3 +65,25 @@ flex: 1 1 100px; min-width: 0; } + +.modifier-stack-authoring .parameter-eyedropper { + min-width: 0; + padding: 0 4px; + color: #d8d8d8; + background: #2e2e2e; + border: 1px solid #4a4a4a; + border-radius: 2px; + font-size: 11px; + line-height: 18px; + cursor: pointer; +} + +.modifier-stack-authoring .parameter-eyedropper:hover { + color: #fff; + background: #4a4a4a; +} + +.modifier-stack-authoring .parameter-eyedropper:disabled { + color: #6a6a6a; + cursor: default; +} diff --git a/web/app/src/app/ModifierParameterField.tsx b/web/app/src/app/ModifierParameterField.tsx index 3bf187ae3..c134d6790 100644 --- a/web/app/src/app/ModifierParameterField.tsx +++ b/web/app/src/app/ModifierParameterField.tsx @@ -2,6 +2,7 @@ import { useEffect, useId, useRef, useState } from "react"; import type { CSSProperties, PointerEvent as ReactPointerEvent, ReactNode } from "react"; import type { ModifierParameterMetadata } from "../../../protocol/modifier"; import { ModifierCurveProfileField } from "./ModifierCurveProfileField"; +import { requestOutlinerPick } from "./outliner-pick"; import { finishModifierInput } from './modifier-input-keyboard'; import './modifier-curve-tools.css'; import zoomInIcon from './curve-icons/zoom_in.svg'; @@ -954,13 +955,19 @@ export function ModifierParameterField({ field, onCommit, onCurveGesture, onInte const numericRange = typeof value === 'number' && field.minimum !== undefined && field.maximum !== undefined && Number.isFinite(field.minimum) && Number.isFinite(field.maximum) && field.minimum < field.maximum; return