You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lunarium_OLD/src/run_modes/editor/panels/properties_view.cpp

62 lines
1.6 KiB
C++

/******************************************************************************
* File - properties_view.h
* Author - Joey Pollack
* Date - 2022/01/26 (y/m/d)
* Mod Date - 2022/01/26 (y/m/d)
* Description - Displayes the properties and components(?) of the selected
* object.
******************************************************************************/
#include "properties_view.h"
#include <dearimgui/imgui.h>
#include <editor/editor.h>
#include <world/entity.h>
#include <world/components.h>
#include <editor/component_guis.h>
namespace lunarium { namespace editor
{
PropertiesView::PropertiesView()
: Panel("Properties", PanelDockZone::DDZ_RIGHT, true), mpSelectedAsset(nullptr), mpSelectedEntity(nullptr)
{
}
bool PropertiesView::DoFrame()
{
if (!mIsOpen)
return false;
if (!ImGui::Begin(GetName(), &mIsOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar))
{
ImGui::End();
return false;
}
if (mpSelectedEntity)
{
// TODO: iterate through components
if (mpSelectedEntity->HasComponent<TagComponent>())
{
CompGui::RenderTagComp(mpSelectedEntity->GetComponent<TagComponent>());
}
}
ImGui::End();
return true;
}
void PropertiesView::SetSelection(Entity* pEntity)
{
mpSelectedAsset = nullptr;
mpSelectedEntity = pEntity;
}
void PropertiesView::SetSelection(EditorAsset* pAsset)
{
mpSelectedEntity = nullptr;
mpSelectedAsset = pAsset;
}
}}