SpiecsEngine
 
Loading...
Searching...
No Matches

◆ ImguiViewport()

Spices::ImguiViewport::ImguiViewport ( const std::string & panelName,
FrameInfo & frameInfo,
uint32_t index = 0 )

Constructor Function.

Parameters
[in]panelNameThe Slate's name to show.
[in]frameInfoThe Frame Date that in use.
[in]indexViewport Index.

Instance a FloattingInfo.

Instance a Gizmos.

Instance a Gizmos.

Build Toggle behave list.

Instance a FloattingInfo.

Instance a Gizmos.

Instance a Gizmos.

Build Toggle behave list.

Definition at line 20 of file ImguiViewport.cpp.

25 : ImguiSlate(panelName, frameInfo)
26 , m_Index(index)
27 {
29
30 {
31 SPICES_PROFILE_ZONEN("Create SceneColor ImTextureID");
32
33 m_ViewportContext = std::make_shared<SlateImage>("SceneColor", "SlateRenderer.Slate.Default");
34 }
35
39 {
40 std::stringstream ss;
41 ss << "FloatingInfo_" << m_Index;
42
43 m_FloatingInfo = SlateSystem::GetRegister()->Register<ImguiFloatingInfo>(false, ss.str(), this);
44 }
45
49 {
50 std::stringstream ss;
51 ss << "Gizmos_" << m_Index;
52
53 m_Gizmos = SlateSystem::GetRegister()->Register<ImguiGizmos>(false, ss.str(), this);
54 }
55
59 {
60 std::stringstream ss;
61 ss << "ToolBar_" << m_Index;
62
63 m_ToolBar = SlateSystem::GetRegister()->Register<ImguiViewportToolBar>(false, ss.str(), this);
64 }
65
69 {
70 m_ToggleStateList = std::make_shared<scl::behave_state_list<void>>();
71
72 {
73 auto state = m_ToggleStateList->AddNode();
74 state->PushBehave("Toggle", [&]() {
75
77
78 if (m_IsToggled)
79 {
81 SlateStyleLayout::Get()->StoreLayoutCache();
82 });
83 }
84 else
85 {
86 m_WindowFlags ^= ImGuiWindowFlags_NoResize & ImGuiWindowFlags_NoMove;
87
89 SlateStyleLayout::Get()->LoadLayoutCache();
90 });
91 }
92 });
93 }
94 {
95 auto state = m_ToggleStateList->AddNode();
96 state->PushBehave("Toggle", [&]() {
97
98 if (m_IsToggled)
99 {
100 const ImGuiViewport* viewport = ImGui::GetMainViewport();
101 ImGui::SetNextWindowPos(viewport->Pos);
102 ImGui::SetNextWindowSize(viewport->Size);
103
104 m_WindowFlags |= ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
105 }
106 });
107 }
108
110 }
111 }
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
ImGuiWindowFlags m_WindowFlags
Flags of this window slate.
Definition ImguiUtils.h:191
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
Definition ImguiUtils.h:35
uint32_t m_Index
This viewport index.
std::shared_ptr< ImguiViewportToolBar > m_ToolBar
The shared pointer of ImguiGizmos.
std::shared_ptr< ImguiGizmos > m_Gizmos
The shared pointer of ImguiGizmos.
std::shared_ptr< scl::behave_state_list< void > > m_ToggleStateList
Toggle behave state list.
bool m_IsToggled
True if this slate toggled this frame.
std::shared_ptr< ImguiFloatingInfo > m_FloatingInfo
The shared pointer of ImguiFloatingInfo.
std::shared_ptr< SlateImage > m_ViewportContext
SlateImage of SceneColor.
static std::shared_ptr< SlateStyleLayout > Get()
Get this single instance.
static std::shared_ptr< SlateRegister > GetRegister()
Get slate register.
Definition SlateSystem.h:67
behave_state_node< Ret, Args... > * AddNode()
Add a empty node to this list.
void SetState(uint32_t state)
Set Current State.
void PushBehave(const std::string &name, const std::function< Ret(Args...)> &fn)
Push a behave to this state.
static auto AsyncTask(ThreadPoolEnum pool, F &&func, Args &&... args) -> std::future< decltype(func(std::forward< Args >(args)...))>

References Spices::ImguiSlate::ImguiSlate(), and m_Index.