Pulled the color picker into the new modes system
This commit is contained in:
parent
b2579a45b7
commit
a889deaa98
|
@ -789,12 +789,11 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
if (InputType == MemberType_r32)
|
||||
{
|
||||
SetTextInputDestinationToFloat(&State->ActiveTextEntry, &Connection->R32Value);
|
||||
}
|
||||
State->NodeInteraction = NewEmptyNodeInteraction();
|
||||
|
||||
// TODO(Peter): This is wrong, should be something to do with capturing text input
|
||||
State->ActiveCommands = &State->NodeListerCommandRegistry;
|
||||
}
|
||||
State->NodeInteraction = NewEmptyNodeInteraction();
|
||||
}
|
||||
else // This is the case where you dragged the value
|
||||
{
|
||||
State->NodeInteraction = NewEmptyNodeInteraction();
|
||||
|
@ -820,22 +819,14 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
|||
RenderNodeList(State->NodeList, State->NodeRenderSettings, RenderBuffer);
|
||||
}
|
||||
|
||||
if (State->ColorPickerEditValue != 0)
|
||||
{
|
||||
b32 ShouldClose = EvaluateColorPicker(RenderBuffer, State->ColorPickerEditValue,
|
||||
v2{200, 200}, State->Interface, GuiMouse);
|
||||
|
||||
if (ShouldClose)
|
||||
{
|
||||
State->ColorPickerEditValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 m = 0; m < State->Modes.ActiveModesCount; m++)
|
||||
{
|
||||
operation_mode OperationMode = State->Modes.ActiveModes[m];
|
||||
if (OperationMode.Render != 0)
|
||||
{
|
||||
OperationMode.Render(State, RenderBuffer, OperationMode, GuiMouse);
|
||||
}
|
||||
}
|
||||
|
||||
DrawDebugInterface(RenderBuffer, 25,
|
||||
State->Interface, Context.WindowWidth, Context.WindowHeight - TopBarHeight,
|
||||
|
|
|
@ -84,7 +84,7 @@ struct app_state
|
|||
s32 TotalLEDsCount;
|
||||
led_buffer* LEDBufferList;
|
||||
|
||||
// TODO(Peter): Make this dynamic. WE want them contiguous in memory since we'll be accessing them
|
||||
// TODO(Peter): Make this dynamic. We want them contiguous in memory since we'll be accessing them
|
||||
// mostly by looping through them. On the other hand, I don't expect there to ever be more than 100
|
||||
// of them at once.
|
||||
#define ASSEMBLY_LIST_LENGTH 32
|
||||
|
@ -102,11 +102,12 @@ struct app_state
|
|||
node_render_settings NodeRenderSettings;
|
||||
interface_node* OutputNode;
|
||||
|
||||
v4* ColorPickerEditValue;
|
||||
|
||||
string GeneralPurposeSearchString;
|
||||
};
|
||||
|
||||
// TODO(Peter): Once rendering nodes becomes an operation_mode you can get rid of this pre-declaration
|
||||
internal void OpenColorPicker(app_state* State, v4* Address);
|
||||
|
||||
#include "foldhaus_debug_visuals.h"
|
||||
#include "foldhaus_sacn_view.cpp"
|
||||
#include "foldhaus_command_dispatch.cpp"
|
||||
|
|
|
@ -241,3 +241,49 @@ FOLDHAUS_INPUT_COMMAND_PROC(OpenNodeLister)
|
|||
OpState->ListPosition = Mouse.Pos;
|
||||
SetTextInputDestinationToString(&State->ActiveTextEntry, &State->GeneralPurposeSearchString);
|
||||
}
|
||||
|
||||
////////////////////////////////////////
|
||||
//
|
||||
// Node Color Picker
|
||||
//
|
||||
///////////////////////////////////////
|
||||
|
||||
struct color_picker_operation_state
|
||||
{
|
||||
v4* ValueAddr;
|
||||
};
|
||||
|
||||
internal void
|
||||
CloseColorPicker(app_state* State)
|
||||
{
|
||||
DeactivateCurrentOperationMode(&State->Modes);
|
||||
}
|
||||
|
||||
OPERATION_RENDER_PROC(RenderColorPicker)
|
||||
{
|
||||
// TODO(Peter): Pass this in as a parameter
|
||||
operation_mode Mode = State->Modes.ActiveModes[State->Modes.ActiveModesCount - 1];
|
||||
color_picker_operation_state* OpState = (color_picker_operation_state*)Mode.OpStateMemory;
|
||||
|
||||
|
||||
b32 ShouldClose = EvaluateColorPicker(RenderBuffer, OpState->ValueAddr,
|
||||
v2{200, 200}, State->Interface, GuiMouse);
|
||||
|
||||
if (ShouldClose)
|
||||
{
|
||||
CloseColorPicker(State);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
OpenColorPicker(app_state* State, v4* ValueAddr)
|
||||
{
|
||||
// TODO(Peter): This won't work with hot code reloading
|
||||
operation_mode* ColorPickerMode = ActivateOperationMode(&State->Modes);
|
||||
ColorPickerMode->Render = RenderColorPicker;
|
||||
|
||||
color_picker_operation_state* OpState = CreateOperationState(ColorPickerMode,
|
||||
&State->Modes,
|
||||
color_picker_operation_state);
|
||||
OpState->ValueAddr = ValueAddr;
|
||||
}
|
|
@ -775,7 +775,11 @@ UpdateDraggingNodeValue (v2 MousePos, v2 LastFrameMousePos, node_interaction Int
|
|||
|
||||
case MemberType_v4:
|
||||
{
|
||||
State->ColorPickerEditValue = &Connection->V4Value;
|
||||
// TODO(Peter): This is a problem. We seem to be calling this several times
|
||||
if (MagSqr(MouseDelta) < 10)
|
||||
{
|
||||
OpenColorPicker(State, &Connection->V4Value);
|
||||
}
|
||||
}break;
|
||||
|
||||
case MemberType_NODE_COLOR_BUFFER: {} break; // NOTE(Peter): Unused for now
|
||||
|
|
22
todo.txt
22
todo.txt
|
@ -2,26 +2,18 @@ TODO FOLDHAUS
|
|||
|
||||
Intermediate Lifetime Memory & Operations
|
||||
x Intermediate lifetime memory arena
|
||||
- Temporary memory region = a multi frame operation
|
||||
- Concept of an operation - temporary memory + interface command registry
|
||||
- Allow one operation at a time at first
|
||||
- Push/pop operations on a list?
|
||||
x Temporary memory region = a multi frame operation
|
||||
x Concept of an operation - temporary memory + interface command registry
|
||||
x Allow one operation at a time at first
|
||||
x Push/pop operations on a list?
|
||||
- Current Operations:
|
||||
- - View Sculpture
|
||||
- - View Sculpture (this might be an exception since its so central)
|
||||
- - View/Edit Nodes
|
||||
- x Add Node (needs nesting)
|
||||
- - View SACN
|
||||
- x View SACN
|
||||
|
||||
- Why does backspacing in text entry not save when you close and reopen the node lister?
|
||||
|
||||
Plan
|
||||
x start with adding nodes
|
||||
x push/pop an operation
|
||||
x create operation structure
|
||||
x static size of operations list
|
||||
x move command registry out of search lister and text entry into operation
|
||||
x initialize/cleanup add node operation
|
||||
- extend to other operations
|
||||
- Typing a period into a float value doesn't register
|
||||
|
||||
Hardening
|
||||
- memory visualization
|
||||
|
|
Loading…
Reference in New Issue