basically removed the need for the meta system from the codebase, and implemented pushing new panel types on a LIFO queue with return memory destinations
This commit is contained in:
parent
bfd50c9129
commit
85b99b17a2
|
@ -20,16 +20,23 @@ enum panel_edit_mode
|
||||||
};
|
};
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
SetPanelDefinition(panel* Panel, s32 NewPanelDefinitionIndex, app_state* State, context Context)
|
SetPanelType_(panel* Panel, s32 NewPanelTypeIndex, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
s32 OldPanelDefinitionIndex = Panel->PanelDefinitionIndex;
|
|
||||||
Panel->PanelDefinitionIndex = NewPanelDefinitionIndex;
|
s32 OldPanelDefinitionIndex = Panel_GetCurrentTypeIndex(Panel);
|
||||||
|
Panel_SetCurrentTypeIndex(Panel, NewPanelTypeIndex, {0});
|
||||||
|
|
||||||
if(OldPanelDefinitionIndex >= 0)
|
if(OldPanelDefinitionIndex >= 0)
|
||||||
{
|
{
|
||||||
GlobalPanelDefs[OldPanelDefinitionIndex].Cleanup(Panel, State);
|
GlobalPanelDefs[OldPanelDefinitionIndex].Cleanup(Panel, State);
|
||||||
}
|
}
|
||||||
GlobalPanelDefs[NewPanelDefinitionIndex].Init(Panel, State, Context);
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
SetAndInitPanelType(panel* Panel, s32 NewPanelTypeIndex, app_state* State, context Context)
|
||||||
|
{
|
||||||
|
SetPanelType_(Panel, NewPanelTypeIndex, State, Context);
|
||||||
|
GlobalPanelDefs[NewPanelTypeIndex].Init(Panel, State, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -250,11 +257,11 @@ FOLDHAUS_INPUT_COMMAND_PROC(EndSplitPanelOperation)
|
||||||
SplitPanelHorizontally(Panel, YPercent, &State->PanelSystem);
|
SplitPanelHorizontally(Panel, YPercent, &State->PanelSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel->Left->Panel.PanelDefinitionIndex = Panel->PanelDefinitionIndex;
|
s32 PanelTypeIndex = Panel_GetCurrentTypeIndex(Panel);
|
||||||
Panel->Left->Panel.PanelStateMemory = Panel->PanelStateMemory;
|
gs_data PanelStateMemory = Panel_GetCurrentTypeStateMemory_(Panel);
|
||||||
Panel->Left->Panel.PanelStateMemorySize = Panel->PanelStateMemorySize;
|
Panel_SetCurrentTypeIndex(&Panel->Left->Panel, PanelTypeIndex, PanelStateMemory);
|
||||||
|
|
||||||
SetPanelDefinition(&Panel->Right->Panel, Panel->PanelDefinitionIndex, State, Context);
|
SetAndInitPanelType(&Panel->Right->Panel, PanelTypeIndex, State, Context);
|
||||||
|
|
||||||
DeactivateCurrentOperationMode(&State->Modes);
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
}
|
}
|
||||||
|
@ -431,7 +438,7 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect2 FooterB
|
||||||
gs_string DefName = MakeString(Def.PanelName, Def.PanelNameLength);
|
gs_string DefName = MakeString(Def.PanelName, Def.PanelNameLength);
|
||||||
if (ui_Button(&State->Interface, DefName, ButtonBounds))
|
if (ui_Button(&State->Interface, DefName, ButtonBounds))
|
||||||
{
|
{
|
||||||
SetPanelDefinition(Panel, i, State, Context);
|
SetAndInitPanelType(Panel, i, State, Context);
|
||||||
Panel->PanelSelectionMenuOpen = false;
|
Panel->PanelSelectionMenuOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +456,8 @@ DrawPanelFooter(panel* Panel, render_command_buffer* RenderBuffer, rect2 FooterB
|
||||||
internal void
|
internal void
|
||||||
RenderPanel(panel* Panel, rect2 PanelBounds, rect2 WindowBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
RenderPanel(panel* Panel, rect2 PanelBounds, rect2 WindowBounds, render_command_buffer* RenderBuffer, app_state* State, context Context, mouse_state Mouse)
|
||||||
{
|
{
|
||||||
Assert(Panel->PanelDefinitionIndex >= 0);
|
s32 PanelType = Panel_GetCurrentTypeIndex(Panel);
|
||||||
|
Assert(PanelType >= 0);
|
||||||
|
|
||||||
rect2 FooterBounds = rect2{
|
rect2 FooterBounds = rect2{
|
||||||
PanelBounds.Min,
|
PanelBounds.Min,
|
||||||
|
@ -460,8 +468,8 @@ RenderPanel(panel* Panel, rect2 PanelBounds, rect2 WindowBounds, render_command_
|
||||||
PanelBounds.Max,
|
PanelBounds.Max,
|
||||||
};
|
};
|
||||||
|
|
||||||
panel_definition Definition = GlobalPanelDefs[Panel->PanelDefinitionIndex];
|
panel_definition Definition = GlobalPanelDefs[PanelType];
|
||||||
Definition.Render(*Panel, PanelViewBounds, RenderBuffer, State, Context);
|
Definition.Render(Panel, PanelViewBounds, RenderBuffer, State, Context);
|
||||||
|
|
||||||
PushRenderOrthographic(RenderBuffer, WindowBounds);
|
PushRenderOrthographic(RenderBuffer, WindowBounds);
|
||||||
DrawPanelFooter(Panel, RenderBuffer, FooterBounds, Mouse, State, Context);
|
DrawPanelFooter(Panel, RenderBuffer, FooterBounds, Mouse, State, Context);
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
//
|
//
|
||||||
#ifndef FOLDHAUS_PANEL_H
|
#ifndef FOLDHAUS_PANEL_H
|
||||||
|
|
||||||
typedef struct panel panel;
|
|
||||||
|
|
||||||
enum panel_split_direction
|
enum panel_split_direction
|
||||||
{
|
{
|
||||||
PanelSplit_NoSplit,
|
PanelSplit_NoSplit,
|
||||||
|
@ -24,9 +22,15 @@ typedef struct panel_entry panel_entry;
|
||||||
|
|
||||||
struct panel
|
struct panel
|
||||||
{
|
{
|
||||||
|
|
||||||
// TODO(pjs): We want this to be a list, so that you can push sub panels on
|
// TODO(pjs): We want this to be a list, so that you can push sub panels on
|
||||||
// and let them return to you, to perform certain tasks, like loading a file
|
// and let them return to you, to perform certain tasks, like loading a file
|
||||||
s32 PanelDefinitionIndex;
|
//s32 PanelDefinitionIndex;
|
||||||
|
#define PANEL_TYPE_INDICES_COUNT_MAX 4
|
||||||
|
s32 TypeIndicesCount;
|
||||||
|
s32 TypeIndices[PANEL_TYPE_INDICES_COUNT_MAX];
|
||||||
|
gs_data ReturnDestMemory[PANEL_TYPE_INDICES_COUNT_MAX];
|
||||||
|
gs_data TypeStateMemory[PANEL_TYPE_INDICES_COUNT_MAX];
|
||||||
|
|
||||||
panel_split_direction SplitDirection;
|
panel_split_direction SplitDirection;
|
||||||
r32 SplitPercent;
|
r32 SplitPercent;
|
||||||
|
@ -35,9 +39,6 @@ struct panel
|
||||||
// Probably belongs in a more generalized PanelInterfaceState or something
|
// Probably belongs in a more generalized PanelInterfaceState or something
|
||||||
b32 PanelSelectionMenuOpen;
|
b32 PanelSelectionMenuOpen;
|
||||||
|
|
||||||
u8* PanelStateMemory;
|
|
||||||
u32 PanelStateMemorySize;
|
|
||||||
|
|
||||||
union{
|
union{
|
||||||
panel_entry* Left;
|
panel_entry* Left;
|
||||||
panel_entry* Top;
|
panel_entry* Top;
|
||||||
|
@ -119,10 +120,7 @@ TakeNewPanel(panel_system* PanelSystem)
|
||||||
panel* Result = 0;
|
panel* Result = 0;
|
||||||
panel_entry* FreeEntry = TakeNewPanelEntry(PanelSystem);
|
panel_entry* FreeEntry = TakeNewPanelEntry(PanelSystem);
|
||||||
Result = &FreeEntry->Panel;
|
Result = &FreeEntry->Panel;
|
||||||
|
|
||||||
*Result = {0};
|
*Result = {0};
|
||||||
Result->PanelDefinitionIndex = -1;
|
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +153,70 @@ FreePanelAtIndex(s32 Index, panel_system* PanelSystem)
|
||||||
PanelSystem->FreeList.Free.Next = EntryToFree;
|
PanelSystem->FreeList.Free.Next = EntryToFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
Panel_SetCurrentTypeIndex(panel* Panel, s32 NewPanelType, gs_data TypeStateMemory, gs_data ReturnDestMemory = {0})
|
||||||
|
{
|
||||||
|
u32 CurrentTypeIndex = 0;
|
||||||
|
if (Panel->TypeIndicesCount != 0)
|
||||||
|
{
|
||||||
|
CurrentTypeIndex = Panel->TypeIndicesCount - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentTypeIndex = Panel->TypeIndicesCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Panel->TypeIndices[CurrentTypeIndex] = NewPanelType;
|
||||||
|
Panel->TypeStateMemory[CurrentTypeIndex] = TypeStateMemory;
|
||||||
|
Panel->ReturnDestMemory[CurrentTypeIndex] = ReturnDestMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal s32
|
||||||
|
Panel_GetCurrentTypeIndex(panel* Panel)
|
||||||
|
{
|
||||||
|
s32 Result = -1;
|
||||||
|
if (Panel->TypeIndicesCount != 0)
|
||||||
|
{
|
||||||
|
Result = Panel->TypeIndices[Panel->TypeIndicesCount - 1];
|
||||||
|
}
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
Panel_SetCurrentTypeStateMemory(panel* Panel, gs_data StateMemory)
|
||||||
|
{
|
||||||
|
u32 CurrentTypeIndex = 0;
|
||||||
|
if (Panel->TypeIndicesCount != 0)
|
||||||
|
{
|
||||||
|
CurrentTypeIndex = Panel->TypeIndicesCount - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentTypeIndex = Panel->TypeIndicesCount++;
|
||||||
|
}
|
||||||
|
Panel->TypeStateMemory[CurrentTypeIndex] = StateMemory;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define Panel_GetCurrentTypeStateMemory(p, type) (type*)Panel_GetCurrentTypeStateMemory_(p).Memory
|
||||||
|
internal gs_data
|
||||||
|
Panel_GetCurrentTypeStateMemory_(panel* Panel)
|
||||||
|
{
|
||||||
|
gs_data Result = {0};
|
||||||
|
if (Panel->TypeIndicesCount != 0)
|
||||||
|
{
|
||||||
|
Result = Panel->TypeStateMemory[Panel->TypeIndicesCount - 1];
|
||||||
|
}
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void
|
||||||
|
Panel_PushTypeWithReturn(panel* Panel, s32 NewPanelType, gs_data ReturnDestMemory)
|
||||||
|
{
|
||||||
|
Assert(Panel->TypeIndicesCount < PANEL_TYPE_INDICES_COUNT_MAX);
|
||||||
|
u32 NewTypeIndex = Panel->TypeIndicesCount++;
|
||||||
|
Panel_SetCurrentTypeIndex(Panel, NewPanelType, ReturnDestMemory);
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
SplitPanel(panel* Parent, r32 Percent, panel_split_direction SplitDirection, panel_system* PanelSystem)
|
SplitPanel(panel* Parent, r32 Percent, panel_split_direction SplitDirection, panel_system* PanelSystem)
|
||||||
{
|
{
|
||||||
|
@ -163,11 +225,13 @@ SplitPanel(panel* Parent, r32 Percent, panel_split_direction SplitDirection, pan
|
||||||
Parent->SplitDirection = SplitDirection;
|
Parent->SplitDirection = SplitDirection;
|
||||||
Parent->SplitPercent = Percent;
|
Parent->SplitPercent = Percent;
|
||||||
|
|
||||||
|
s32 ParentTypeIndex = Panel_GetCurrentTypeIndex(Parent);
|
||||||
|
gs_data ParentStateMemory = Panel_GetCurrentTypeStateMemory_(Parent);
|
||||||
Parent->Left = TakeNewPanelEntry(PanelSystem);
|
Parent->Left = TakeNewPanelEntry(PanelSystem);
|
||||||
Parent->Left->Panel.PanelDefinitionIndex = Parent->PanelDefinitionIndex;
|
Panel_SetCurrentTypeIndex(&Parent->Left->Panel, ParentTypeIndex, ParentStateMemory);
|
||||||
|
|
||||||
Parent->Right = TakeNewPanelEntry(PanelSystem);
|
Parent->Right = TakeNewPanelEntry(PanelSystem);
|
||||||
Parent->Right->Panel.PanelDefinitionIndex = Parent->PanelDefinitionIndex;
|
Panel_SetCurrentTypeIndex(&Parent->Right->Panel, ParentTypeIndex, ParentStateMemory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef FOLDHAUS_PANEL_ANIMATION_TIMELINE_H
|
#ifndef FOLDHAUS_PANEL_ANIMATION_TIMELINE_H
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
global v4 TimeSliderColor = v4{.36f, .52f, .78f, 1.f};
|
global v4 TimeSliderColor = GreenV4; //v4{.36f, .52f, .78f, 1.f};
|
||||||
|
|
||||||
//
|
//
|
||||||
struct animation_timeline_state
|
struct animation_timeline_state
|
||||||
|
@ -288,7 +288,8 @@ AnimationTimeline_Init(panel* Panel, app_state* State, context Context)
|
||||||
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
||||||
animation_timeline_state* TimelineState = PushStruct(&State->Permanent, animation_timeline_state);
|
animation_timeline_state* TimelineState = PushStruct(&State->Permanent, animation_timeline_state);
|
||||||
TimelineState->VisibleRange = ActiveAnim->PlayableRange;
|
TimelineState->VisibleRange = ActiveAnim->PlayableRange;
|
||||||
Panel->PanelStateMemory = (u8*)TimelineState;
|
|
||||||
|
Panel_SetCurrentTypeStateMemory(Panel, StructToData(TimelineState, animation_timeline_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
GSMetaTag(panel_cleanup);
|
GSMetaTag(panel_cleanup);
|
||||||
|
@ -595,9 +596,9 @@ DrawAnimationClipsList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedA
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_animation_timeline);
|
GSMetaTag(panel_type_animation_timeline);
|
||||||
internal void
|
internal void
|
||||||
AnimationTimeline_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
AnimationTimeline_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
animation_timeline_state* TimelineState = (animation_timeline_state*)Panel.PanelStateMemory;
|
animation_timeline_state* TimelineState = Panel_GetCurrentTypeStateMemory(Panel, animation_timeline_state);
|
||||||
// TODO(pjs): SelectedAnimationBlockHandle should be a property of animation_timeline_state
|
// TODO(pjs): SelectedAnimationBlockHandle should be a property of animation_timeline_state
|
||||||
// unless its used elsewhere. Audit later
|
// unless its used elsewhere. Audit later
|
||||||
gs_list_handle SelectedBlockHandle = State->SelectedAnimationBlockHandle;
|
gs_list_handle SelectedBlockHandle = State->SelectedAnimationBlockHandle;
|
||||||
|
@ -611,7 +612,7 @@ AnimationTimeline_Render(panel Panel, rect2 PanelBounds, render_command_buffer*
|
||||||
|
|
||||||
ui_FillRect(Interface, TitleBarBounds, Interface->Style.PanelBGColors[0]);
|
ui_FillRect(Interface, TitleBarBounds, Interface->Style.PanelBGColors[0]);
|
||||||
ui_layout TitleBarLayout = ui_CreateLayout(*Interface, TitleBarBounds);
|
ui_layout TitleBarLayout = ui_CreateLayout(*Interface, TitleBarBounds);
|
||||||
ui_StartRow(&TitleBarLayout, 3);
|
ui_StartRow(&TitleBarLayout, 4);
|
||||||
{
|
{
|
||||||
if (ui_LayoutButton(Interface, &TitleBarLayout, MakeString("Pause")))
|
if (ui_LayoutButton(Interface, &TitleBarLayout, MakeString("Pause")))
|
||||||
{
|
{
|
||||||
|
@ -628,6 +629,18 @@ AnimationTimeline_Render(panel Panel, rect2 PanelBounds, render_command_buffer*
|
||||||
State->AnimationSystem.TimelineShouldAdvance = false;
|
State->AnimationSystem.TimelineShouldAdvance = false;
|
||||||
State->AnimationSystem.CurrentFrame = 0;
|
State->AnimationSystem.CurrentFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ui_LayoutButton(Interface, &TitleBarLayout, MakeString("Load")))
|
||||||
|
{
|
||||||
|
// TODO(pjs): You were working on #6 on your todo list.
|
||||||
|
// below is a "write the interface first" example of how you'd like to be able to
|
||||||
|
// activate a file panel from within another panel.
|
||||||
|
gs_data ReturnDestination = {};
|
||||||
|
Panel_PushTypeWithReturn(Panel, PanelType_FileView, ReturnDestination);
|
||||||
|
// TODO(pjs): I think we want to be able to specify a return command that gets called when the
|
||||||
|
// pushed panel state returns to this one
|
||||||
|
// something like: AnimPanel_HandleLoadedAnimationFile
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ui_EndRow(&TitleBarLayout);
|
ui_EndRow(&TitleBarLayout);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ DrawSACNUniversePixels (render_command_buffer* RenderBuffer, sacn_universe* ToDr
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_dmx_view);
|
GSMetaTag(panel_type_dmx_view);
|
||||||
internal void
|
internal void
|
||||||
DMXView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
DMXView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// :NoLongerFunctionalSACNCodeButThatsOk
|
// :NoLongerFunctionalSACNCodeButThatsOk
|
||||||
|
|
|
@ -55,7 +55,7 @@ FileView_Init(panel* Panel, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
// TODO: :FreePanelMemory
|
// TODO: :FreePanelMemory
|
||||||
file_view_state* FileViewState = PushStruct(&State->Permanent, file_view_state);
|
file_view_state* FileViewState = PushStruct(&State->Permanent, file_view_state);
|
||||||
Panel->PanelStateMemory = (u8*)FileViewState;
|
Panel_SetCurrentTypeStateMemory(Panel, StructToData(FileViewState, file_view_state));
|
||||||
FileViewState->FileNamesArena = CreateMemoryArena(Context.ThreadContext.Allocator);
|
FileViewState->FileNamesArena = CreateMemoryArena(Context.ThreadContext.Allocator);
|
||||||
FileViewUpdateWorkingDirectory(ConstString("."), FileViewState, Context);
|
FileViewUpdateWorkingDirectory(ConstString("."), FileViewState, Context);
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,9 @@ FileView_Cleanup(panel* Panel, app_state* State)
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_file_view);
|
GSMetaTag(panel_type_file_view);
|
||||||
internal void
|
internal void
|
||||||
FileView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
FileView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
file_view_state* FileViewState = (file_view_state*)Panel.PanelStateMemory;
|
file_view_state* FileViewState = Panel_GetCurrentTypeStateMemory(Panel, file_view_state);
|
||||||
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
|
|
|
@ -27,7 +27,7 @@ HierarchyView_Cleanup(panel* Panel, app_state* State)
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_hierarchy);
|
GSMetaTag(panel_type_hierarchy);
|
||||||
internal void
|
internal void
|
||||||
HierarchyView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
HierarchyView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
ui_layout Layout = ui_CreateLayout(State->Interface, PanelBounds);
|
||||||
gs_string TempString = PushString(State->Transient, 256);
|
gs_string TempString = PushString(State->Transient, 256);
|
||||||
|
|
|
@ -137,7 +137,7 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_layout Layout, debu
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_profiler);
|
GSMetaTag(panel_type_profiler);
|
||||||
internal void
|
internal void
|
||||||
ProfilerView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
ProfilerView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
gs_memory_arena* Memory = State->Transient;
|
gs_memory_arena* Memory = State->Transient;
|
||||||
gs_string String = PushString(Memory, 256);
|
gs_string String = PushString(Memory, 256);
|
||||||
|
|
|
@ -156,7 +156,7 @@ SculptureView_WorldToScreenPosition(v4 WorldPosition, camera Camera, rect2 Panel
|
||||||
GSMetaTag(panel_render);
|
GSMetaTag(panel_render);
|
||||||
GSMetaTag(panel_type_sculpture_view);
|
GSMetaTag(panel_type_sculpture_view);
|
||||||
internal void
|
internal void
|
||||||
SculptureView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
SculptureView_Render(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
{
|
{
|
||||||
DEBUG_TRACK_SCOPE(RenderSculpture);
|
DEBUG_TRACK_SCOPE(RenderSculpture);
|
||||||
State->Camera.AspectRatio = RectAspectRatio(PanelBounds);
|
State->Camera.AspectRatio = RectAspectRatio(PanelBounds);
|
||||||
|
@ -203,7 +203,6 @@ SculptureView_Render(panel Panel, rect2 PanelBounds, render_command_buffer* Rend
|
||||||
assembly Assembly = State->Assemblies.Values[0];
|
assembly Assembly = State->Assemblies.Values[0];
|
||||||
led_buffer* LedBuffer = LedSystemGetBuffer(&State->LedSystem, Assembly.LedBufferIndex);
|
led_buffer* LedBuffer = LedSystemGetBuffer(&State->LedSystem, Assembly.LedBufferIndex);
|
||||||
|
|
||||||
//__debugbreak();
|
|
||||||
v4 LedPosition = LedBuffer->Positions[FocusPixel];
|
v4 LedPosition = LedBuffer->Positions[FocusPixel];
|
||||||
v2 LedOnScreenPosition = SculptureView_WorldToScreenPosition(LedPosition, State->Camera, PanelBounds);
|
v2 LedOnScreenPosition = SculptureView_WorldToScreenPosition(LedPosition, State->Camera, PanelBounds);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_types.cpp
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-10-17
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_TYPES_CPP
|
||||||
|
global s32 GlobalPanelDefsCount = 6;
|
||||||
|
global panel_definition GlobalPanelDefs[] = {
|
||||||
|
{ "File View", 9, FileView_Init, FileView_Cleanup, FileView_Render, FileView_Commands, FileView_CommandsCount },
|
||||||
|
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands, SculptureView_CommandsCount },
|
||||||
|
{ "Animation Timeline", 18, AnimationTimeline_Init, AnimationTimeline_Cleanup, AnimationTimeline_Render, AnimationTimeline_Commands, AnimationTimeline_CommandsCount },
|
||||||
|
{ "Dmx View", 8, DMXView_Init, DMXView_Cleanup, DMXView_Render, DMXView_Commands, DMXView_CommandsCount },
|
||||||
|
{ "Hierarchy", 9, HierarchyView_Init, HierarchyView_Cleanup, HierarchyView_Render, HierarchyView_Commands, HierarchyView_CommandsCount },
|
||||||
|
{ "Profiler", 8, ProfilerView_Init, ProfilerView_Cleanup, ProfilerView_Render, ProfilerView_Commands, ProfilerView_CommandsCount },
|
||||||
|
};
|
||||||
|
#define FOLDHAUS_PANEL_TYPES_CPP
|
||||||
|
#endif // FOLDHAUS_PANEL_TYPES_CPP
|
|
@ -0,0 +1,17 @@
|
||||||
|
//
|
||||||
|
// File: foldhaus_panel_types.h
|
||||||
|
// Author: Peter Slattery
|
||||||
|
// Creation Date: 2020-10-17
|
||||||
|
//
|
||||||
|
#ifndef FOLDHAUS_PANEL_TYPES_H
|
||||||
|
enum panel_type {
|
||||||
|
PanelType_FileView,
|
||||||
|
PanelType_SculptureView,
|
||||||
|
PanelType_AnimationTimeline,
|
||||||
|
PanelType_DMXView,
|
||||||
|
PanelType_HierarchyView,
|
||||||
|
PanelType_NodeGraph,
|
||||||
|
PanelType_ProfilerView,
|
||||||
|
};
|
||||||
|
#define FOLDHAUS_PANEL_TYPES_H
|
||||||
|
#endif // FOLDHAUS_PANEL_TYPES_H
|
|
@ -163,7 +163,6 @@ Assembly_ConstructStrip(assembly* Assembly, led_buffer* LedBuffer, v2_strip* Str
|
||||||
strip_gen_sequence Sequence = GenData.Sequence;
|
strip_gen_sequence Sequence = GenData.Sequence;
|
||||||
for (u32 i = 0; i < Sequence.ElementsCount; i++)
|
for (u32 i = 0; i < Sequence.ElementsCount; i++)
|
||||||
{
|
{
|
||||||
__debugbreak();
|
|
||||||
strip_gen_data SegmentGenData = Sequence.Elements[i];
|
strip_gen_data SegmentGenData = Sequence.Elements[i];
|
||||||
LedsAdded += Assembly_ConstructStrip(Assembly, LedBuffer, StripAt, SegmentGenData, RootPosition, LedStartIndex + LedsAdded);
|
LedsAdded += Assembly_ConstructStrip(Assembly, LedBuffer, StripAt, SegmentGenData, RootPosition, LedStartIndex + LedsAdded);
|
||||||
}
|
}
|
|
@ -162,7 +162,7 @@ INITIALIZE_APPLICATION(InitializeApplication)
|
||||||
|
|
||||||
InitializePanelSystem(&State->PanelSystem);
|
InitializePanelSystem(&State->PanelSystem);
|
||||||
panel* Panel = TakeNewPanel(&State->PanelSystem);
|
panel* Panel = TakeNewPanel(&State->PanelSystem);
|
||||||
SetPanelDefinition(Panel, PanelType_SculptureView, State, Context);
|
SetAndInitPanelType(Panel, PanelType_SculptureView, State, Context);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
|
@ -184,7 +184,8 @@ HandleInput (app_state* State, rect2 WindowBounds, input_queue InputQueue, mouse
|
||||||
if (!PanelWithMouseOverIt.Panel) { return; }
|
if (!PanelWithMouseOverIt.Panel) { return; }
|
||||||
State->HotPanel = PanelWithMouseOverIt.Panel;
|
State->HotPanel = PanelWithMouseOverIt.Panel;
|
||||||
|
|
||||||
panel_definition PanelDefinition = GlobalPanelDefs[PanelWithMouseOverIt.Panel->PanelDefinitionIndex];
|
s32 PanelTypeIndex = Panel_GetCurrentTypeIndex(PanelWithMouseOverIt.Panel);
|
||||||
|
panel_definition PanelDefinition = GlobalPanelDefs[PanelTypeIndex];
|
||||||
if (!PanelDefinition.InputCommands) { return; }
|
if (!PanelDefinition.InputCommands) { return; }
|
||||||
|
|
||||||
ActiveCommands.Commands = PanelDefinition.InputCommands;
|
ActiveCommands.Commands = PanelDefinition.InputCommands;
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
#include "engine/foldhaus_network_ordering.h"
|
#include "engine/foldhaus_network_ordering.h"
|
||||||
|
|
||||||
#include "engine/foldhaus_assembly.h"
|
#include "engine/assembly/foldhaus_assembly.h"
|
||||||
#include "engine/foldhaus_assembly_parser.cpp"
|
#include "engine/assembly/foldhaus_assembly_parser.cpp"
|
||||||
|
|
||||||
#include "engine/sacn/foldhaus_sacn.h"
|
#include "engine/sacn/foldhaus_sacn.h"
|
||||||
#include "engine/uart/foldhaus_uart.h"
|
#include "engine/uart/foldhaus_uart.h"
|
||||||
|
@ -70,7 +70,7 @@ struct app_state
|
||||||
|
|
||||||
internal void OpenColorPicker(app_state* State, v4* Address);
|
internal void OpenColorPicker(app_state* State, v4* Address);
|
||||||
|
|
||||||
#include "engine/foldhaus_assembly.cpp"
|
#include "engine/assembly/foldhaus_assembly.cpp"
|
||||||
|
|
||||||
// BEGIN TEMPORARY PATTERNS
|
// BEGIN TEMPORARY PATTERNS
|
||||||
internal void
|
internal void
|
||||||
|
@ -215,7 +215,7 @@ typedef PANEL_INIT_PROC(panel_init_proc);
|
||||||
#define PANEL_CLEANUP_PROC(name) void name(panel* Panel, app_state* State)
|
#define PANEL_CLEANUP_PROC(name) void name(panel* Panel, app_state* State)
|
||||||
typedef PANEL_CLEANUP_PROC(panel_cleanup_proc);
|
typedef PANEL_CLEANUP_PROC(panel_cleanup_proc);
|
||||||
|
|
||||||
#define PANEL_RENDER_PROC(name) void name(panel Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
#define PANEL_RENDER_PROC(name) void name(panel* Panel, rect2 PanelBounds, render_command_buffer* RenderBuffer, app_state* State, context Context)
|
||||||
typedef PANEL_RENDER_PROC(panel_render_proc);
|
typedef PANEL_RENDER_PROC(panel_render_proc);
|
||||||
|
|
||||||
// NOTE(Peter): This is used by the meta system to generate panel type info
|
// NOTE(Peter): This is used by the meta system to generate panel type info
|
||||||
|
@ -237,6 +237,8 @@ animation_clip GlobalAnimationClips[] = {
|
||||||
{ "Test Pattern Three", 18, TestPatternThree },
|
{ "Test Pattern Three", 18, TestPatternThree },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include "editor/panels/foldhaus_panel_types.h"
|
||||||
|
|
||||||
#include "editor/panels/foldhaus_panel_sculpture_view.h"
|
#include "editor/panels/foldhaus_panel_sculpture_view.h"
|
||||||
#include "editor/panels/foldhaus_panel_profiler.h"
|
#include "editor/panels/foldhaus_panel_profiler.h"
|
||||||
#include "editor/panels/foldhaus_panel_dmx_view.h"
|
#include "editor/panels/foldhaus_panel_dmx_view.h"
|
||||||
|
@ -244,7 +246,8 @@ animation_clip GlobalAnimationClips[] = {
|
||||||
#include "editor/panels/foldhaus_panel_hierarchy.h"
|
#include "editor/panels/foldhaus_panel_hierarchy.h"
|
||||||
#include "editor/panels/foldhaus_panel_file_view.h"
|
#include "editor/panels/foldhaus_panel_file_view.h"
|
||||||
|
|
||||||
#include "generated/foldhaus_panels_generated.h"
|
#include "editor/panels/foldhaus_panel_types.cpp"
|
||||||
|
//#include "generated/foldhaus_panels_generated.h"
|
||||||
|
|
||||||
#include "editor/foldhaus_interface.cpp"
|
#include "editor/foldhaus_interface.cpp"
|
||||||
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
enum panel_type {
|
|
||||||
PanelType_FileView,
|
|
||||||
PanelType_SculptureView,
|
|
||||||
PanelType_AnimationTimeline,
|
|
||||||
PanelType_DMXView,
|
|
||||||
PanelType_HierarchyView,
|
|
||||||
PanelType_NodeGraph,
|
|
||||||
PanelType_ProfilerView,
|
|
||||||
};
|
|
||||||
global s32 GlobalPanelDefsCount = 6;
|
|
||||||
global panel_definition GlobalPanelDefs[] = {
|
|
||||||
{ "File View", 9, FileView_Init, FileView_Cleanup, FileView_Render, FileView_Commands, FileView_CommandsCount },
|
|
||||||
{ "Sculpture View", 14, SculptureView_Init, SculptureView_Cleanup, SculptureView_Render, SculptureView_Commands, SculptureView_CommandsCount },
|
|
||||||
{ "Animation Timeline", 18, AnimationTimeline_Init, AnimationTimeline_Cleanup, AnimationTimeline_Render, AnimationTimeline_Commands, AnimationTimeline_CommandsCount },
|
|
||||||
{ "Dmx View", 8, DMXView_Init, DMXView_Cleanup, DMXView_Render, DMXView_Commands, DMXView_CommandsCount },
|
|
||||||
{ "Hierarchy", 9, HierarchyView_Init, HierarchyView_Cleanup, HierarchyView_Render, HierarchyView_Commands, HierarchyView_CommandsCount },
|
|
||||||
{ "Profiler", 8, ProfilerView_Init, ProfilerView_Cleanup, ProfilerView_Render, ProfilerView_Commands, ProfilerView_CommandsCount },
|
|
||||||
};
|
|
|
@ -5,6 +5,16 @@
|
||||||
//
|
//
|
||||||
#ifndef GS_TYPES_CPP
|
#ifndef GS_TYPES_CPP
|
||||||
|
|
||||||
|
#define StructToData(ptr, type) StructToData_((u8*)(ptr), sizeof(type))
|
||||||
|
internal gs_data
|
||||||
|
StructToData_(u8* Memory, u64 Size)
|
||||||
|
{
|
||||||
|
gs_data Result = {0};
|
||||||
|
Result.Memory = Memory;
|
||||||
|
Result.Size = Size;
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
internal u32
|
internal u32
|
||||||
U32DivideRoundUp (u32 A, u32 B)
|
U32DivideRoundUp (u32 A, u32 B)
|
||||||
{
|
{
|
||||||
|
|
|
@ -348,7 +348,6 @@ int main(int ArgCount, char* Args[])
|
||||||
|
|
||||||
FinishMetaprogram(&Meta);
|
FinishMetaprogram(&Meta);
|
||||||
|
|
||||||
//__debugbreak();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue