From 938568037a212eae4060342f73c3b2b032b85082 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Fri, 9 Jun 2023 16:53:26 +0200 Subject: [PATCH] please, click on diamond to enable sequenced --- .../src/propEditors/DefaultValueIndicator.tsx | 12 ++-- .../useEditingToolsForCompoundProp.tsx | 42 ++++++++------ .../useEditingToolsForSimpleProp.tsx | 56 +++++++++++-------- 3 files changed, 65 insertions(+), 45 deletions(-) diff --git a/theatre/studio/src/propEditors/DefaultValueIndicator.tsx b/theatre/studio/src/propEditors/DefaultValueIndicator.tsx index a5869d6..c88534a 100644 --- a/theatre/studio/src/propEditors/DefaultValueIndicator.tsx +++ b/theatre/studio/src/propEditors/DefaultValueIndicator.tsx @@ -46,11 +46,15 @@ const FilledIcon = styled.div` border: 1px solid grey; ` -const DefaultOrStaticValueIndicator: React.FC<{hasStaticOverride: boolean}> = ( - props, -) => { +const DefaultOrStaticValueIndicator: React.FC<{ + hasStaticOverride: boolean + callbackPlease: () => void +}> = (props) => { + const whoopsy = (lol: any) => { + props.callbackPlease() + } return ( - + {props.hasStaticOverride ? ( ) : ( diff --git a/theatre/studio/src/propEditors/useEditingToolsForCompoundProp.tsx b/theatre/studio/src/propEditors/useEditingToolsForCompoundProp.tsx index 368002b..0ef230d 100644 --- a/theatre/studio/src/propEditors/useEditingToolsForCompoundProp.tsx +++ b/theatre/studio/src/propEditors/useEditingToolsForCompoundProp.tsx @@ -65,7 +65,12 @@ export function useEditingToolsForCompoundProp( beingScrubbed: false, contextMenuItems: [], controlIndicators: ( - + { + console.log('nothing to do') + }} + /> ), } } @@ -171,28 +176,26 @@ export function useEditingToolsForCompoundProp( }) } + const makeThisPropSequencedPlease = () => { + getStudio()!.transaction(({stateEditors}) => { + for (const {path, conf} of iteratePropType(propConfig, pathToProp)) { + if (isPropConfigComposite(conf)) continue + const propAddress = {...obj.address, pathToProp: path} + + stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsSequenced( + propAddress, + propConfig, + ) + } + }) + } if ( !hasOneOrMoreSequencedTracks || (hasOneOrMoreSequencedTracks && hasStatics) ) { contextMenuItems.push({ label: 'Sequence all', - callback: () => { - getStudio()!.transaction(({stateEditors}) => { - for (const {path, conf} of iteratePropType( - propConfig, - pathToProp, - )) { - if (isPropConfigComposite(conf)) continue - const propAddress = {...obj.address, pathToProp: path} - - stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsSequenced( - propAddress, - propConfig, - ) - } - }) - }, + callback: makeThisPropSequencedPlease, }) } @@ -224,7 +227,10 @@ export function useEditingToolsForCompoundProp( ...common, type: 'AllStatic', controlIndicators: ( - + ), } } diff --git a/theatre/studio/src/propEditors/useEditingToolsForSimpleProp.tsx b/theatre/studio/src/propEditors/useEditingToolsForSimpleProp.tsx index 9c0293a..c97aea9 100644 --- a/theatre/studio/src/propEditors/useEditingToolsForSimpleProp.tsx +++ b/theatre/studio/src/propEditors/useEditingToolsForSimpleProp.tsx @@ -155,20 +155,22 @@ function createPrism( const isSequenced = typeof possibleSequenceTrackId === 'string' + const makeThisPropStaticPlease = () => { + getStudio()!.transaction(({stateEditors}) => { + const propAddress = {...obj.address, pathToProp} + stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsStatic( + { + ...propAddress, + value: obj.getValueByPointer(pointerToProp) as T, + }, + ) + }) + } + if (isSequenced) { contextMenuItems.push({ label: 'Make static', - callback: () => { - getStudio()!.transaction(({stateEditors}) => { - const propAddress = {...obj.address, pathToProp} - stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsStatic( - { - ...propAddress, - value: obj.getValueByPointer(pointerToProp) as T, - }, - ) - }) - }, + callback: makeThisPropStaticPlease, }) const sequenceTrackId = possibleSequenceTrackId as SequenceTrackId @@ -287,19 +289,21 @@ function createPrism( }) } + const makeThisPropSequencedPlease = () => { + getStudio()!.transaction(({stateEditors, set}) => { + const propAddress = {...obj.address, pathToProp} + + stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsSequenced( + propAddress, + propConfig, + ) + }) + } + if (isSequencable) { contextMenuItems.push({ label: 'Sequence', - callback: () => { - getStudio()!.transaction(({stateEditors}) => { - const propAddress = {...obj.address, pathToProp} - - stateEditors.coreByProject.historic.sheetsById.sequence.setPrimitivePropAsSequenced( - propAddress, - propConfig, - ) - }) - }, + callback: makeThisPropSequencedPlease, }) } @@ -309,7 +313,10 @@ function createPrism( type: 'Static', shade: common.beingScrubbed ? 'Static_BeingScrubbed' : 'Static', controlIndicators: ( - + ), } return ret @@ -320,7 +327,10 @@ function createPrism( type: 'Default', shade: 'Default', controlIndicators: ( - + ), }