Working on child window
This commit is contained in:
parent
a02469b935
commit
ee2bac28f9
@ -10,31 +10,31 @@ Collapsed=0
|
|||||||
|
|
||||||
[Window][Terrain Editor]
|
[Window][Terrain Editor]
|
||||||
Pos=925,24
|
Pos=925,24
|
||||||
Size=355,413
|
Size=355,434
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,0
|
DockId=0x00000006,0
|
||||||
|
|
||||||
[Window][Viewport]
|
[Window][Viewport]
|
||||||
Pos=309,24
|
Pos=309,24
|
||||||
Size=614,413
|
Size=614,434
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
[Window][ViewportPannel]
|
[Window][ViewportPannel]
|
||||||
Pos=309,24
|
Pos=309,24
|
||||||
Size=614,413
|
Size=614,434
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,1
|
DockId=0x00000005,1
|
||||||
|
|
||||||
[Window][ShaderExplorer]
|
[Window][ShaderExplorer]
|
||||||
Pos=0,439
|
Pos=0,460
|
||||||
Size=1280,281
|
Size=1280,260
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,0
|
DockId=0x00000004,0
|
||||||
|
|
||||||
[Window][TreePannel]
|
[Window][TreePannel]
|
||||||
Pos=0,24
|
Pos=0,24
|
||||||
Size=307,413
|
Size=307,434
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000001,0
|
DockId=0x00000001,0
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ DockId=0x00000004,0
|
|||||||
|
|
||||||
[Window][PropertiesPannel]
|
[Window][PropertiesPannel]
|
||||||
Pos=925,24
|
Pos=925,24
|
||||||
Size=355,413
|
Size=355,434
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,1
|
DockId=0x00000006,1
|
||||||
|
|
||||||
@ -73,17 +73,17 @@ Collapsed=0
|
|||||||
DockId=0x00000005,2
|
DockId=0x00000005,2
|
||||||
|
|
||||||
[Window][AssetExplorer]
|
[Window][AssetExplorer]
|
||||||
Pos=0,439
|
Pos=0,460
|
||||||
Size=1280,281
|
Size=1280,260
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,1
|
DockId=0x00000004,1
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y Selected=0x34A4C10F
|
DockSpace ID=0xA1672E74 Window=0x4647B76E Pos=0,24 Size=1280,696 Split=Y Selected=0x34A4C10F
|
||||||
DockNode ID=0x00000003 Parent=0xA1672E74 SizeRef=1280,413 Split=X
|
DockNode ID=0x00000003 Parent=0xA1672E74 SizeRef=1280,434 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=307,696 Selected=0xE45B9F93
|
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=307,696 Selected=0xE45B9F93
|
||||||
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=971,696 Split=X Selected=0x34A4C10F
|
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=971,696 Split=X Selected=0x34A4C10F
|
||||||
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=614,454 CentralNode=1 Selected=0x34A4C10F
|
DockNode ID=0x00000005 Parent=0x00000002 SizeRef=614,454 CentralNode=1 Selected=0x34A4C10F
|
||||||
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=355,454 Selected=0xA35A27E3
|
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=355,454 Selected=0xA35A27E3
|
||||||
DockNode ID=0x00000004 Parent=0xA1672E74 SizeRef=1280,281 Selected=0x21191D0B
|
DockNode ID=0x00000004 Parent=0xA1672E74 SizeRef=1280,260 Selected=0x21191D0B
|
||||||
|
|
||||||
|
@ -18,13 +18,18 @@ namespace Deer {
|
|||||||
// Renders a component node
|
// Renders a component node
|
||||||
bool componentNode(std::string&, CScriptAny*, asIScriptFunction*);
|
bool componentNode(std::string&, CScriptAny*, asIScriptFunction*);
|
||||||
// Renders a component node with option to menu
|
// Renders a component node with option to menu
|
||||||
bool componentNode_contextMenu(std::string&, CScriptAny*, asIScriptFunction*, asIScriptFunction*);
|
bool componentNode_contextMenu(std::string&, CScriptAny*,
|
||||||
|
asIScriptFunction*, asIScriptFunction*);
|
||||||
// Renders a tree leaf
|
// Renders a tree leaf
|
||||||
void treeNode(std::string&, bool);
|
void treeNode(std::string&, bool);
|
||||||
// Renders a tree node with its sub nodes
|
// Renders a tree node with its sub nodes
|
||||||
bool treeNodeRecursive(std::string&, bool, CScriptAny*, asIScriptFunction&);
|
bool treeNodeRecursive(std::string&, bool, CScriptAny*,
|
||||||
|
asIScriptFunction&);
|
||||||
|
|
||||||
|
// Call, x, y, border
|
||||||
|
void childWindow(CScriptAny*, asIScriptFunction*, int, int, bool);
|
||||||
|
|
||||||
void space();
|
void space();
|
||||||
void space_params(int, int);
|
void space_params(int, int);
|
||||||
}
|
} // namespace EditorEngine
|
||||||
}
|
} // namespace Deer
|
@ -1,9 +1,9 @@
|
|||||||
#include "DeerStudio/EditorEngine/API/Layout.h"
|
#include "DeerStudio/EditorEngine/API/Layout.h"
|
||||||
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
|
||||||
#include "DeerStudio/EditorEngine.h"
|
#include "DeerStudio/EditorEngine.h"
|
||||||
|
#include "DeerStudio/EditorEngine/ErrorHandle.h"
|
||||||
#include "angelscript.h"
|
#include "angelscript.h"
|
||||||
#include "scriptany.h"
|
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
#include "scriptany.h"
|
||||||
|
|
||||||
namespace Deer {
|
namespace Deer {
|
||||||
namespace EditorEngine {
|
namespace EditorEngine {
|
||||||
@ -18,7 +18,8 @@ namespace Deer {
|
|||||||
ImGui::TreeNodeEx(txt.c_str(), flags);
|
ImGui::TreeNodeEx(txt.c_str(), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool treeNodeRecursive(std::string& txt, bool active, CScriptAny *data, asIScriptFunction& func) {
|
bool treeNodeRecursive(std::string& txt, bool active, CScriptAny* data,
|
||||||
|
asIScriptFunction& func) {
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||||
ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags_OpenOnDoubleClick |
|
ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags_OpenOnDoubleClick |
|
||||||
ImGuiTreeNodeFlags_OpenOnArrow |
|
ImGuiTreeNodeFlags_OpenOnArrow |
|
||||||
@ -30,21 +31,18 @@ namespace Deer {
|
|||||||
|
|
||||||
if (ImGui::TreeNodeEx(txt.c_str(), flags)) {
|
if (ImGui::TreeNodeEx(txt.c_str(), flags)) {
|
||||||
ImGui::PushID(txt.c_str());
|
ImGui::PushID(txt.c_str());
|
||||||
if (executingScriptContext && executingScriptContext->PushState() == asSUCCESS) {
|
if (executingScriptContext &&
|
||||||
|
executingScriptContext->PushState() == asSUCCESS) {
|
||||||
AS_CHECK_ADDITIONAL_INFO(
|
AS_CHECK_ADDITIONAL_INFO(
|
||||||
executingScriptContext->Prepare(&func),
|
executingScriptContext->Prepare(&func),
|
||||||
func.GetDeclaration()
|
func.GetDeclaration());
|
||||||
);
|
|
||||||
|
|
||||||
AS_CHECK_ADDITIONAL_INFO(
|
AS_CHECK_ADDITIONAL_INFO(
|
||||||
executingScriptContext->SetArgObject(0, data),
|
executingScriptContext->SetArgObject(0, data),
|
||||||
func.GetDeclaration()
|
func.GetDeclaration());
|
||||||
);
|
|
||||||
|
|
||||||
AS_CHECK_ADDITIONAL_INFO(
|
AS_CHECK_ADDITIONAL_INFO(executingScriptContext->Execute(),
|
||||||
executingScriptContext->Execute(),
|
func.GetDeclaration());
|
||||||
func.GetDeclaration()
|
|
||||||
);
|
|
||||||
|
|
||||||
executingScriptContext->PopState();
|
executingScriptContext->PopState();
|
||||||
} else {
|
} else {
|
||||||
@ -54,7 +52,6 @@ namespace Deer {
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
|
|
||||||
|
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -63,7 +60,8 @@ namespace Deer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool componentNode(std::string& txt, CScriptAny* data, asIScriptFunction* func) {
|
bool componentNode(std::string& txt, CScriptAny* data,
|
||||||
|
asIScriptFunction* func) {
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4));
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||||
@ -77,7 +75,8 @@ namespace Deer {
|
|||||||
if (ImGui::TreeNodeEx(txt.c_str(), flags)) {
|
if (ImGui::TreeNodeEx(txt.c_str(), flags)) {
|
||||||
ImGui::Dummy(ImVec2(0, 10));
|
ImGui::Dummy(ImVec2(0, 10));
|
||||||
ImGui::PushID(txt.c_str());
|
ImGui::PushID(txt.c_str());
|
||||||
if (executingScriptContext && executingScriptContext->PushState() == asSUCCESS) {
|
if (executingScriptContext &&
|
||||||
|
executingScriptContext->PushState() == asSUCCESS) {
|
||||||
|
|
||||||
AS_CHECK(executingScriptContext->Prepare(func));
|
AS_CHECK(executingScriptContext->Prepare(func));
|
||||||
|
|
||||||
@ -102,7 +101,9 @@ namespace Deer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool componentNode_contextMenu(std::string& txt, CScriptAny* data, asIScriptFunction* func, asIScriptFunction* menu) {
|
bool componentNode_contextMenu(std::string& txt, CScriptAny* data,
|
||||||
|
asIScriptFunction* func,
|
||||||
|
asIScriptFunction* menu) {
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4));
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(4, 4));
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||||
@ -114,9 +115,11 @@ namespace Deer {
|
|||||||
ImGuiTreeNodeFlags_DefaultOpen;
|
ImGuiTreeNodeFlags_DefaultOpen;
|
||||||
|
|
||||||
if (ImGui::TreeNodeEx(txt.c_str(), flags)) {
|
if (ImGui::TreeNodeEx(txt.c_str(), flags)) {
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10, 10));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,
|
||||||
|
ImVec2(10, 10));
|
||||||
if (ImGui::BeginPopupContextItem(txt.c_str())) {
|
if (ImGui::BeginPopupContextItem(txt.c_str())) {
|
||||||
if (executingScriptContext && executingScriptContext->PushState() == asSUCCESS) {
|
if (executingScriptContext &&
|
||||||
|
executingScriptContext->PushState() == asSUCCESS) {
|
||||||
|
|
||||||
AS_CHECK(executingScriptContext->Prepare(menu));
|
AS_CHECK(executingScriptContext->Prepare(menu));
|
||||||
|
|
||||||
@ -134,7 +137,8 @@ namespace Deer {
|
|||||||
|
|
||||||
ImGui::Dummy(ImVec2(0, 10));
|
ImGui::Dummy(ImVec2(0, 10));
|
||||||
ImGui::PushID(txt.c_str());
|
ImGui::PushID(txt.c_str());
|
||||||
if (executingScriptContext && executingScriptContext->PushState() == asSUCCESS) {
|
if (executingScriptContext &&
|
||||||
|
executingScriptContext->PushState() == asSUCCESS) {
|
||||||
|
|
||||||
AS_CHECK(executingScriptContext->Prepare(func));
|
AS_CHECK(executingScriptContext->Prepare(func));
|
||||||
|
|
||||||
@ -159,9 +163,7 @@ namespace Deer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupColumns(int i) {
|
void setupColumns(int i) { ImGui::Columns(i, nullptr, false); }
|
||||||
ImGui::Columns(i, nullptr, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setupAutomaticColumns(int pixelSize) {
|
void setupAutomaticColumns(int pixelSize) {
|
||||||
float width = ImGui::GetWindowContentRegionWidth();
|
float width = ImGui::GetWindowContentRegionWidth();
|
||||||
@ -177,20 +179,15 @@ namespace Deer {
|
|||||||
ImGui::Columns(cols, 0, false);
|
ImGui::Columns(cols, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void endColumns() {
|
void childWindow(CScriptAny* data, asIScriptFunction* func, int width,
|
||||||
ImGui::Columns();
|
int height, bool border) {}
|
||||||
}
|
|
||||||
|
|
||||||
void nextColumn() {
|
void endColumns() { ImGui::Columns(); }
|
||||||
ImGui::NextColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
void space() {
|
void nextColumn() { ImGui::NextColumn(); }
|
||||||
ImGui::Dummy(ImVec2(10, 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
void space_params(int x, int y) {
|
void space() { ImGui::Dummy(ImVec2(10, 10)); }
|
||||||
ImGui::Dummy(ImVec2(x, y));
|
|
||||||
}
|
void space_params(int x, int y) { ImGui::Dummy(ImVec2(x, y)); }
|
||||||
}
|
} // namespace EditorEngine
|
||||||
}
|
} // namespace Deer
|
@ -11,6 +11,19 @@ bool drawFolder(string&in name) {
|
|||||||
return click;
|
return click;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool drawIcon(string&in name, string&in iconName) {
|
||||||
|
bool click = false;
|
||||||
|
UI::drawIconCentered(iconName, 64);
|
||||||
|
|
||||||
|
if (UI::isItemClicked(0) and UI::isMouseDoubleClicked(0)) {
|
||||||
|
click = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
UI::textCenter(name);
|
||||||
|
UI::nextColumn();
|
||||||
|
return click;
|
||||||
|
}
|
||||||
|
|
||||||
bool drawFile(string&in name) {
|
bool drawFile(string&in name) {
|
||||||
bool click = false;
|
bool click = false;
|
||||||
UI::drawIconCentered("file", 64);
|
UI::drawIconCentered("file", 64);
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
AssetType renderRootAssets() {
|
AssetType renderRootAssets() {
|
||||||
AssetType selectedAssetType = AssetType::None;
|
AssetType selectedAssetType = AssetType::None;
|
||||||
|
|
||||||
if (drawFolder("Scripts")) selectedAssetType = AssetType::None;
|
if (drawIcon("Scripts", "script")) selectedAssetType = AssetType::None;
|
||||||
if (drawFolder("Meshes")) selectedAssetType = AssetType::Mesh;
|
if (drawIcon("Meshes", "mesh")) selectedAssetType = AssetType::Mesh;
|
||||||
if (drawFolder("Textures")) selectedAssetType = AssetType::None;
|
if (drawIcon("Textures", "texture")) selectedAssetType = AssetType::None;
|
||||||
if (drawFolder("Shaders")) selectedAssetType = AssetType::Shader;
|
if (drawIcon("Shaders", "shader")) selectedAssetType = AssetType::Shader;
|
||||||
|
|
||||||
return selectedAssetType;
|
return selectedAssetType;
|
||||||
}
|
}
|
||||||
|
BIN
roe/Editor/icons/mesh.ase
Normal file
BIN
roe/Editor/icons/mesh.ase
Normal file
Binary file not shown.
BIN
roe/Editor/icons/mesh.png
Normal file
BIN
roe/Editor/icons/mesh.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 515 B |
BIN
roe/Editor/icons/script.png
Normal file
BIN
roe/Editor/icons/script.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 B |
Binary file not shown.
Before Width: | Height: | Size: 270 B After Width: | Height: | Size: 569 B |
BIN
roe/Editor/icons/texture.png
Normal file
BIN
roe/Editor/icons/texture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 453 B |
Loading…
x
Reference in New Issue
Block a user