Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/api/src/extensions/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export type ContextMenuButtonMetadata = Omit<ButtonMetadata, 'type' | 'value'>;
export interface PixiMetadata {
type: PixiNodeType;
locked?: boolean;
visible?: boolean;
suffix?: string;
buttons?: ButtonMetadata[];
contextMenu?: ContextMenuButtonMetadata[];
Expand Down
5 changes: 5 additions & 0 deletions packages/backend/src/scene/tree/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class Tree extends PixiHandler {
metadata: {
type,
locked: container.__devtoolLocked,
visible: container.visible,
uid: this._getId(container),
suffix,
buttons: [],
Expand Down Expand Up @@ -129,6 +130,10 @@ export class Tree extends PixiHandler {
node.__devtoolLocked = value;
}

if (buttonAction === 'visible') {
node.visible = value ?? true;
}

this._onButtonPressExtensions.forEach((ext) => {
ext.onButtonPress(node, buttonAction, value);
});
Expand Down
17 changes: 17 additions & 0 deletions packages/frontend/src/pages/scene/graph/tree/node-trigger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
FaMinus as LayerIconOpen,
FaLock as LockIcon,
FaLockOpen as LockOpenIcon,
FaEye as VisibleIcon,
FaEyeSlash as HiddenIcon,
// FaRegObjectGroup as SceneNodeIcon,
} from 'react-icons/fa6';
import { Input } from '../../../../components/ui/input';
Expand Down Expand Up @@ -73,6 +75,21 @@ export const NodeTrigger: React.FC<{
{node.data.metadata.buttons?.map((button, i) => (
<CustomNodeButton key={node.id + button.name + i} node={node} button={button} bridge={bridge} />
))}
<TooltipWrapper
contentProps={{ side: 'left' }}
providerProps={{ delayDuration: 2500 }}
trigger={
<CustomNodeButton
asChild={true}
button={{ name: 'visible', type: 'toggle', value: node.data.metadata.visible ?? true }}
icon={node.data.metadata.visible ?? true ? <VisibleIcon /> : <HiddenIcon />}
node={node}
className="mt-[-2px] w-[20px] px-1 py-0.5"
bridge={bridge}
/>
}
tip={'Toggle the visibility of the node.'}
/>
<TooltipWrapper
contentProps={{ side: 'left' }}
providerProps={{ delayDuration: 2500 }}
Expand Down
Loading