| 80 | } |
| 81 | |
| 82 | void ObjectEditorWindow::Draw() { |
| 83 | if (!opened) |
| 84 | return; |
| 85 | |
| 86 | if (ImGui::Begin(windowTitle.c_str(), &opened)) { |
| 87 | // Check if I have fill object properties |
| 88 | if (!objectGUIProps.GetSize() || !objectEditorProps.GetSize()) { |
| 89 | // object properties are empty |
| 90 | RefreshGUIProperties(); |
| 91 | RefreshEditorProperties(); |
| 92 | } |
| 93 | |
| 94 | ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 4.f); |
| 95 | |
| 96 | //---------------------------------------------------------------------- |
| 97 | // Object properties |
| 98 | //---------------------------------------------------------------------- |
| 99 | |
| 100 | if (ImGui::CollapsingHeader((objectName + " properties").c_str(), NULL, true, true)) { |
| 101 | ImGui::PushID("Object properties"); |
| 102 | ImGui::PushItemWidth(ImGui::GetWindowSize().x / 3); |
| 103 | |
| 104 | //------------------------------------------------------------------ |
| 105 | // Object GUI |
| 106 | //------------------------------------------------------------------ |
| 107 | |
| 108 | if (DrawObjectGUI(objectGUIProps, modifiedGUIProps)) |
| 109 | ParseGUIProperties(); |
| 110 | |
| 111 | //------------------------------------------------------------------ |
| 112 | // Refresh + Parse buttons |
| 113 | //------------------------------------------------------------------ |
| 114 | |
| 115 | if (!IsDynamicEditor()) { |
| 116 | if (ImGui::Button("Refresh")) |
| 117 | RefreshGUIProperties(); |
| 118 | |
| 119 | ImGui::SameLine(); |
| 120 | |
| 121 | if (ImGui::Button(modifiedGUIProps ? "Apply (*)" : "Apply")) |
| 122 | ParseGUIProperties(); |
| 123 | } |
| 124 | |
| 125 | ImGui::PopItemWidth(); |
| 126 | ImGui::PopID(); |
| 127 | } |
| 128 | |
| 129 | //---------------------------------------------------------------------- |
| 130 | // Advance editing |
| 131 | //---------------------------------------------------------------------- |
| 132 | |
| 133 | if (ImGui::CollapsingHeader("Advance editor", NULL, true, false)) { |
| 134 | ImGui::PushID("Advance editor"); |
| 135 | |
| 136 | //------------------------------------------------------------------ |
| 137 | // Refresh + Parse buttons |
| 138 | //------------------------------------------------------------------ |
| 139 | |