|
|
|
|
/******************************************************************************
|
|
|
|
|
* 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, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar),
|
|
|
|
|
mpSelectedAsset(nullptr), mpSelectedEntity(nullptr), mIsLocked(false)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
// RENDER METHOD
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void PropertiesView::DoFrame()
|
|
|
|
|
{
|
|
|
|
|
ShowToolBar();
|
|
|
|
|
|
|
|
|
|
if (mpSelectedEntity)
|
|
|
|
|
{
|
|
|
|
|
ShowEntity();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mpSelectedAsset)
|
|
|
|
|
{
|
|
|
|
|
ShowAsset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
// INTERFACE METHODS
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
void PropertiesView::SetSelection(Entity* pEntity)
|
|
|
|
|
{
|
|
|
|
|
if (mIsLocked)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mpSelectedAsset = nullptr;
|
|
|
|
|
mpSelectedEntity = pEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertiesView::SetSelection(EditorAsset* pAsset)
|
|
|
|
|
{
|
|
|
|
|
if (mIsLocked)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mpSelectedEntity = nullptr;
|
|
|
|
|
mpSelectedAsset = pAsset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
// HELPER METHODS HELPER METHODS
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
void PropertiesView::ShowToolBar()
|
|
|
|
|
{
|
|
|
|
|
ImGui::BeginChild("##PropsToolBar", ImVec2(0, ImGui::GetFrameHeightWithSpacing()));
|
|
|
|
|
|
|
|
|
|
ImGui::Checkbox("Locked", &mIsLocked);
|
|
|
|
|
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
ImGui::Separator();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertiesView::ShowEntity()
|
|
|
|
|
{
|
|
|
|
|
ImGui::Text("Components");
|
|
|
|
|
|
|
|
|
|
// TODO: iterate through components
|
|
|
|
|
if (mpSelectedEntity->HasComponent<TagComponent>())
|
|
|
|
|
{
|
|
|
|
|
CompGui::RenderTagComp(mpSelectedEntity->GetComponent<TagComponent>());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PropertiesView::ShowAsset()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}}
|