Editor Assets can draw their properties

master
Joey Pollack 3 years ago
parent 17fa0aeb68
commit 9e49450b0b

@ -28,6 +28,13 @@ If "%~2" == "rd" set "DEBINFO=1"
IF defined RELEASE ( IF defined RELEASE (
cmake --build build/ --target ALL_BUILD --config Release cmake --build build/ --target ALL_BUILD --config Release
SET BUILD_ERRORLEVEL=!ERRORLEVEL!
IF NOT "!BUILD_ERRORLEVEL!"=="0" (
echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%
EXIT /B !BUILD_ERRORLEVEL!
)
xcopy /y test_data\engine_state.json build\Release\ xcopy /y test_data\engine_state.json build\Release\
xcopy /y src\renderer\shaders\* build\Release\* xcopy /y src\renderer\shaders\* build\Release\*
@ -35,23 +42,31 @@ xcopy /y src\renderer\shaders\* build\Release\*
) ELSE IF defined DEBINFO ( ) ELSE IF defined DEBINFO (
cmake --build build/ --target ALL_BUILD --config RelWithDebInfo cmake --build build/ --target ALL_BUILD --config RelWithDebInfo
SET BUILD_ERRORLEVEL=!ERRORLEVEL!
IF NOT "!BUILD_ERRORLEVEL!"=="0" (
echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%
EXIT /B !BUILD_ERRORLEVEL!
)
xcopy /y test_data\engine_state.json build\RelWithDebInfo\ xcopy /y test_data\engine_state.json build\RelWithDebInfo\
xcopy /y src\renderer\shaders\* build\RelWithDebInfo\* xcopy /y src\renderer\shaders\* build\RelWithDebInfo\*
) ELSE ( ) ELSE (
cmake --build build/ --target ALL_BUILD --config Debug cmake --build build/ --target ALL_BUILD --config Debug
xcopy /y test_data\engine_state.json build\Debug\
xcopy /y src\renderer\shaders\* build\Debug\*
)
SET BUILD_ERRORLEVEL=!ERRORLEVEL! SET BUILD_ERRORLEVEL=!ERRORLEVEL!
IF NOT "!BUILD_ERRORLEVEL!"=="0" ( IF NOT "!BUILD_ERRORLEVEL!"=="0" (
echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL% echo %ESC%[91mBUILD FAILED!%ESC%[0m %BUILD_ERRORLEVEL%
EXIT /B !BUILD_ERRORLEVEL! EXIT /B !BUILD_ERRORLEVEL!
) )
xcopy /y test_data\engine_state.json build\Debug\
xcopy /y src\renderer\shaders\* build\Debug\*
)
echo %ESC%[92mBUILD SUCCEEDED!%ESC%[0m echo %ESC%[92mBUILD SUCCEEDED!%ESC%[0m
IF defined DELGUI ( IF defined DELGUI (

@ -14,6 +14,7 @@
#include <assets/types/image.h> #include <assets/types/image.h>
#include <utils/logger.h> #include <utils/logger.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <dearimgui/imgui.h>
namespace lunarium { namespace editor namespace lunarium { namespace editor
{ {
@ -174,6 +175,12 @@ namespace lunarium { namespace editor
void TileSet::DrawProperties() void TileSet::DrawProperties()
{ {
int size[2] = { mTileSize.Width, mTileSize.Height };
ImGui::Text("Tile Size: ");
ImGui::SameLine();
if (ImGui::DragInt2("##Tile Size", size))
{
SetTileSize({size[0], size[1]});
}
} }
}} }}

@ -33,6 +33,7 @@ namespace lunarium { namespace editor
[[nodiscard]] virtual OpRes Deserialize(nlohmann::ordered_json& node); [[nodiscard]] virtual OpRes Deserialize(nlohmann::ordered_json& node);
[[nodiscord]] virtual bool IsValidNode(nlohmann::ordered_json& node); [[nodiscord]] virtual bool IsValidNode(nlohmann::ordered_json& node);
[[nodiscard]] virtual nlohmann::ordered_json AsJSON(); [[nodiscard]] virtual nlohmann::ordered_json AsJSON();
void DrawProperties(); void DrawProperties();
lunarium::World* GetWorld(); lunarium::World* GetWorld();

@ -467,5 +467,10 @@ namespace editor
// TODO: Unload current world, Load new world // TODO: Unload current world, Load new world
((WorldTree*)mPanelManager.GetPanel(mPanels.WorldTree))->SetWorld(pWorld); ((WorldTree*)mPanelManager.GetPanel(mPanels.WorldTree))->SetWorld(pWorld);
} }
void Editor::OnAssetSelected(EditorAsset* pAsset)
{
((PropertiesView*)mPanelManager.GetPanel(mPanels.PropertiesView))->SetSelection(pAsset);
}
} }
} }

@ -34,7 +34,7 @@ namespace lunarium { namespace editor
TT_MAP_EDITOR, TT_MAP_EDITOR,
}; };
class EditorAsset;
class MapEditor; class MapEditor;
class Editor : public iRunMode class Editor : public iRunMode
{ {
@ -51,13 +51,14 @@ namespace lunarium { namespace editor
bool IsToolOpen(ToolType type) const; bool IsToolOpen(ToolType type) const;
void ChangeWorld(lunarium::World* pWorld);
std::filesystem::path GetAssetBrowserLocation(); std::filesystem::path GetAssetBrowserLocation();
Project* GetProject(); Project* GetProject();
// Panel events // Panel events
void OnEntitySelect(lunarium::Entity* pEnt); void OnEntitySelect(lunarium::Entity* pEnt);
void ChangeWorld(lunarium::World* pWorld);
void OnAssetSelected(EditorAsset* pAsset);
private: private:
Editor(const Editor&) = delete; Editor(const Editor&) = delete;

@ -145,7 +145,7 @@ namespace editor
float left = xPos; float left = xPos;
ImGui::BeginChild("ToolBar", ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 1.5f)); ImGui::BeginChild("ToolBar", ImVec2(0, ImGui::GetFrameHeightWithSpacing() * 1.5f), false, ImGuiWindowFlags_NoScrollbar);
ImGui::PushFont(GUI::GetInstance().GetFont(GuiFont::FONT_ROBO_SMALL)); ImGui::PushFont(GUI::GetInstance().GetFont(GuiFont::FONT_ROBO_SMALL));
ImGui::TextUnformatted(mpEditor->GetProject()->MakeRelativeToAssets(mSelectedDir, true).string().c_str()); ImGui::TextUnformatted(mpEditor->GetProject()->MakeRelativeToAssets(mSelectedDir, true).string().c_str());
ImGui::PopFont(); ImGui::PopFont();
@ -208,6 +208,7 @@ namespace editor
{ {
// TODO: Show properties if this is new selection (meaning wasn't selected last frame) // TODO: Show properties if this is new selection (meaning wasn't selected last frame)
// Logger::Info(Editor::LogCat, "Asset selected. Properties shold show in the PropertiesView Panel"); // Logger::Info(Editor::LogCat, "Asset selected. Properties shold show in the PropertiesView Panel");
mpEditor->OnAssetSelected((*iter));
} }
if (ImGui::BeginDragDropSource()) if (ImGui::BeginDragDropSource())
{ {

Loading…
Cancel
Save