added editor() command to toggle all other editors
This commit is contained in:
parent
42fad8816b
commit
08fda5a62c
@ -18,7 +18,8 @@ Editor::Editor() :
|
||||
m_selectedMesh(nullptr),
|
||||
m_editedResourcePack(nullptr),
|
||||
m_pickerEnabled(false),
|
||||
m_materialEditorEnabled(false)
|
||||
m_materialEditorEnabled(false),
|
||||
m_editorEnabled(false)
|
||||
{
|
||||
addChild(m_pickerNode);
|
||||
m_pickerNode->setVisible(false);
|
||||
@ -34,6 +35,9 @@ void Editor::update()
|
||||
// no automatic update of children, we want to update them manually
|
||||
// ContainerNode::update();
|
||||
|
||||
if(m_editorEnabled)
|
||||
gui();
|
||||
|
||||
if(m_pickerEnabled)
|
||||
m_pickerNode->update();
|
||||
|
||||
@ -44,6 +48,28 @@ void Editor::update()
|
||||
m_editedResourcePack->gui();
|
||||
}
|
||||
|
||||
void Editor::gui()
|
||||
{
|
||||
ImGui::Begin("SparrowEditor", &m_editorEnabled);
|
||||
{
|
||||
ImGui::Checkbox("Material editor", &m_materialEditorEnabled);
|
||||
|
||||
DeferredPipeline* pipeline = dynamic_cast<DeferredPipeline*>(m_scene->getPipeline());
|
||||
bool pipeline_gui_status = pipeline->isDebugGuiVisible();
|
||||
if(ImGui::Checkbox("Rendering pipeline debug gui", &pipeline_gui_status))
|
||||
pipeline->toggleDebugGui();
|
||||
|
||||
bool resroucePackEditorStatus = m_editedResourcePack;
|
||||
if(ImGui::Checkbox("Resource pack editor editor", &resroucePackEditorStatus))
|
||||
toggleResourcePackGui();
|
||||
|
||||
bool pickerStatus = m_pickerEnabled;
|
||||
if(ImGui::Checkbox("Picker", &pickerStatus))
|
||||
togglePicker();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void Editor::materialGui()
|
||||
{
|
||||
static int selectedOption = 0;
|
||||
@ -87,6 +113,11 @@ void Editor::materialGui()
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void Editor::toggleEditor()
|
||||
{
|
||||
m_editorEnabled = !m_editorEnabled;
|
||||
}
|
||||
|
||||
void Editor::togglePicker()
|
||||
{
|
||||
m_pickerEnabled = !m_pickerEnabled;
|
||||
|
@ -15,11 +15,15 @@ class Editor : public ContainerNode
|
||||
ResourcePack* m_editedResourcePack;
|
||||
bool m_pickerEnabled;
|
||||
bool m_materialEditorEnabled;
|
||||
bool m_editorEnabled;
|
||||
|
||||
void gui();
|
||||
public:
|
||||
Editor();
|
||||
~Editor();
|
||||
void update();
|
||||
void materialGui();
|
||||
void toggleEditor();
|
||||
void togglePicker();
|
||||
void toggleMaterialEditor();
|
||||
void toggleRenderingPipelineGui();
|
||||
|
@ -28,6 +28,7 @@ ScriptNode::ScriptNode()
|
||||
LUA_SET_FUN(materialEditor);
|
||||
LUA_SET_FUN(rendering);
|
||||
LUA_SET_FUN(resourcePackEditor);
|
||||
LUA_SET_FUN(editor);
|
||||
|
||||
m_script.new_usertype<Engine>("Engine",
|
||||
"time",&Engine::getTime
|
||||
@ -113,3 +114,7 @@ void ScriptNode::rendering(){
|
||||
void ScriptNode::resourcePackEditor(){
|
||||
this->getEngine().getEditor()->toggleResourcePackGui();
|
||||
}
|
||||
|
||||
void ScriptNode::editor(){
|
||||
this->getEngine().getEditor()->toggleEditor();
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ public:
|
||||
void materialEditor();
|
||||
void rendering();
|
||||
void resourcePackEditor();
|
||||
void editor();
|
||||
};
|
||||
|
||||
#endif // SCRIPTNODE_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user