Moved renderproperties functions

This commit is contained in:
Sebastian Piwell
2016-05-18 09:33:32 -04:00
parent cd35cea0ee
commit 94d8360e73
6 changed files with 336 additions and 405 deletions

View File

@@ -33,6 +33,7 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/guipropertycomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guitimecomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/include/guiiswacomponent.h
${CMAKE_CURRENT_SOURCE_DIR}/src/renderproperties.cpp
)
source_group("Header Files" FILES ${HEADER_FILES})
@@ -45,6 +46,7 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/guipropertycomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guitimecomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/guiiswacomponent.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/renderproperties.cpp
)
source_group("Source Files" FILES ${SOURCE_FILES})

View File

@@ -28,7 +28,6 @@
#include <modules/onscreengui/include/guicomponent.h>
#include <modules/onscreengui/include/guipropertycomponent.h>
namespace openspace {
namespace gui {

View File

@@ -0,0 +1,46 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2016 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __RENDERPROPERTIES_H__
#define __RENDERPROPERTIES_H__
#include <openspace/engine/openspaceengine.h>
#include <openspace/properties/property.h>
using namespace openspace::properties;
void executeScript(const std::string& id, const std::string& value);
void renderBoolProperty(Property* prop);
void renderOptionProperty(Property* prop);
void renderSelectionProperty(Property* prop);
void renderStringProperty(Property* prop);
void renderIntProperty(Property* prop);
void renderFloatProperty(Property* prop);
void renderVec2Property(Property* prop);
void renderVec3Property(Property* prop);
void renderVec4Property(Property* prop);
void renderTriggerProperty(Property* prop);
#endif __RENDERPROPERTIES_H__

View File

@@ -23,6 +23,7 @@
****************************************************************************************/
#include <modules/onscreengui/include/guiiswacomponent.h>
#include <modules/onscreengui/include/renderproperties.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
@@ -48,165 +49,9 @@
#include "imgui.h"
namespace {
// const ImVec2 size = ImVec2(350, 200);
using json = nlohmann::json;
const std::string _loggerCat = "iSWAComponent";
const ImVec2 size = ImVec2(350, 500);
using namespace openspace::properties;
void executeScript(const std::string& id, const std::string& value) {
std::string script =
"openspace.setPropertyValue('" + id + "', " + value + ");";
OsEng.scriptEngine().queueScript(script);
}
void renderBoolProperty(Property* prop) {
BoolProperty* p = static_cast<BoolProperty*>(prop);
std::string name = p->guiName();
BoolProperty::ValueType value = *p;
ImGui::Checkbox((name).c_str(), &value);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), value ? "true": "false");
}
void renderOptionProperty(Property* prop) {
OptionProperty* p = static_cast<OptionProperty*>(prop);
std::string name = p->guiName();
int value = *p;
std::vector<OptionProperty::Option> options = p->options();
for (const OptionProperty::Option& o : options) {
ImGui::RadioButton((name).c_str(), &value, o.value);
ImGui::SameLine();
ImGui::Text(o.description.c_str());
}
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderSelectionProperty(Property* prop) {
SelectionProperty* p = static_cast<SelectionProperty*>(prop);
std::string name = p->guiName();
if (ImGui::CollapsingHeader((name).c_str())) {
const std::vector<SelectionProperty::Option>& options = p->options();
std::vector<int> newSelectedIndices;
std::vector<int> selectedIndices = p->value();
for (int i = 0; i < options.size(); ++i) {
std::string description = options[i].description;
bool selected = std::find(selectedIndices.begin(), selectedIndices.end(), i) != selectedIndices.end();
ImGui::Checkbox(description.c_str(), &selected);
if (selected)
newSelectedIndices.push_back(i);
}
if (newSelectedIndices != p->value()) {
std::string parameters = "{";
for (int i : newSelectedIndices)
parameters += std::to_string(i) + ",";
parameters += "}";
executeScript(p->fullyQualifiedIdentifier(), parameters);
}
}
}
void renderStringProperty(Property* prop) {
StringProperty* p = static_cast<StringProperty*>(prop);
std::string name = p->guiName();
static const int bufferSize = 256;
static char buffer[bufferSize];
#ifdef _MSC_VER
strcpy_s(buffer, p->value().length() + 1, p->value().c_str());
#else
strcpy(buffer, p->value().c_str());
#endif
ImGui::InputText((name).c_str(), buffer, bufferSize);
std::string newValue(buffer);
if (newValue != p->value() && FileSys.fileExists(newValue))
executeScript(p->fullyQualifiedIdentifier(), "'" + newValue + "'");
}
void renderIntProperty(Property* prop) {
IntProperty* p = static_cast<IntProperty*>(prop);
std::string name = p->guiName();
IntProperty::ValueType value = *p;
ImGui::SliderInt((name).c_str(), &value, p->minValue(), p->maxValue());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderFloatProperty(Property* prop) {
FloatProperty* p = static_cast<FloatProperty*>(prop)
; std::string name = p->guiName();
FloatProperty::ValueType value = *p;
ImGui::SliderFloat((name).c_str(), &value, p->minValue(), p->maxValue());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderVec2Property(Property* prop) {
Vec2Property* p = static_cast<Vec2Property*>(prop);
std::string name = p->guiName();
Vec2Property::ValueType value = *p;
ImGui::SliderFloat2((name).c_str(), &value.x, std::min(p->minValue().x, p->minValue().y), std::max(p->maxValue().x, p->maxValue().y));
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}");
}
void renderVec3Property(Property* prop) {
Vec3Property* p = static_cast<Vec3Property*>(prop);
std::string name = p->guiName();
Vec3Property::ValueType value = *p;
ImGui::SliderFloat3((name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "}");
}
void renderVec4Property(Property* prop) {
Vec4Property* p = static_cast<Vec4Property*>(prop);
std::string name = p->guiName();
Vec4Property::ValueType value = *p;
ImGui::SliderFloat4((name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "," +
std::to_string(value.w) + "}");
}
void renderTriggerProperty(Property* prop) {
std::string name = prop->guiName();
bool pressed = ImGui::Button((name).c_str());
if (pressed)
executeScript(prop->fullyQualifiedIdentifier(), "nil");
}
}
namespace openspace {

View File

@@ -23,6 +23,7 @@
****************************************************************************************/
#include <modules/onscreengui/include/guipropertycomponent.h>
#include <modules/onscreengui/include/renderproperties.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
@@ -42,254 +43,6 @@
namespace {
const std::string _loggerCat = "GuiPropertyComponent";
const ImVec2 size = ImVec2(350, 500);
using namespace openspace::properties;
void executeScript(const std::string& id, const std::string& value) {
std::string script =
"openspace.setPropertyValue('" + id + "', " + value + ");";
OsEng.scriptEngine().queueScript(script);
}
void renderBoolProperty(Property* prop) {
BoolProperty* p = static_cast<BoolProperty*>(prop);
std::string name = p->guiName();
BoolProperty::ValueType value = *p;
ImGui::Checkbox((name).c_str(), &value);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), value ? "true": "false");
}
void renderOptionProperty(Property* prop) {
OptionProperty* p = static_cast<OptionProperty*>(prop);
std::string name = p->guiName();
int value = *p;
std::vector<OptionProperty::Option> options = p->options();
for (const OptionProperty::Option& o : options) {
ImGui::RadioButton((name).c_str(), &value, o.value);
ImGui::SameLine();
ImGui::Text(o.description.c_str());
}
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderSelectionProperty(Property* prop) {
SelectionProperty* p = static_cast<SelectionProperty*>(prop);
std::string name = p->guiName();
if (ImGui::CollapsingHeader((name).c_str())) {
const std::vector<SelectionProperty::Option>& options = p->options();
std::vector<int> newSelectedIndices;
std::vector<int> selectedIndices = p->value();
for (int i = 0; i < options.size(); ++i) {
std::string description = options[i].description;
bool selected = std::find(selectedIndices.begin(), selectedIndices.end(), i) != selectedIndices.end();
ImGui::Checkbox(description.c_str(), &selected);
if (selected)
newSelectedIndices.push_back(i);
}
if (newSelectedIndices != p->value()) {
std::string parameters = "{";
for (int i : newSelectedIndices)
parameters += std::to_string(i) + ",";
parameters += "}";
executeScript(p->fullyQualifiedIdentifier(), parameters);
}
}
}
void renderStringProperty(Property* prop) {
StringProperty* p = static_cast<StringProperty*>(prop);
std::string name = p->guiName();
static const int bufferSize = 256;
static char buffer[bufferSize];
#ifdef _MSC_VER
strcpy_s(buffer, p->value().length() + 1, p->value().c_str());
#else
strcpy(buffer, p->value().c_str());
#endif
ImGui::InputText((name).c_str(), buffer, bufferSize);
std::string newValue(buffer);
if (newValue != p->value() && FileSys.fileExists(newValue))
executeScript(p->fullyQualifiedIdentifier(), "'" + newValue + "'");
}
void renderIntProperty(Property* prop) {
IntProperty* p = static_cast<IntProperty*>(prop);
std::string name = p->guiName();
IntProperty::ValueType value = *p;
ImGui::SliderInt((name).c_str(), &value, p->minValue(), p->maxValue());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderFloatProperty(Property* prop) {
FloatProperty* p = static_cast<FloatProperty*>(prop);
std::string name = p->guiName();
FloatProperty::ValueType value = *p;
ImGui::SliderFloat((name).c_str(), &value, p->minValue(), p->maxValue());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderVec2Property(Property* prop) {
Vec2Property* p = static_cast<Vec2Property*>(prop);
std::string name = p->guiName();
Vec2Property::ValueType value = *p;
ImGui::SliderFloat2((name).c_str(), &value.x, std::min(p->minValue().x, p->minValue().y), std::max(p->maxValue().x, p->maxValue().y));
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}");
}
void renderVec3Property(Property* prop) {
Vec3Property* p = static_cast<Vec3Property*>(prop);
std::string name = p->guiName();
Vec3Property::ValueType value = *p;
ImGui::SliderFloat3((name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "}");
}
void renderVec4Property(Property* prop) {
Vec4Property* p = static_cast<Vec4Property*>(prop);
std::string name = p->guiName();
Vec4Property::ValueType value = *p;
ImGui::SliderFloat4((name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "," +
std::to_string(value.w) + "}");
}
void renderTriggerProperty(Property* prop) {
std::string name = prop->guiName();
bool pressed = ImGui::Button((name).c_str());
if (pressed)
executeScript(prop->fullyQualifiedIdentifier(), "nil");
}
//void renderBoolProperty(Property* prop, const std::string& ownerName) {
// BoolProperty* p = static_cast<BoolProperty*>(prop);
// std::string name = p->guiName();
// BoolProperty::ValueType value = *p;
// ImGui::Checkbox((ownerName + "." + name).c_str(), &value);
// p->set(value);
//}
//void renderOptionProperty(Property* prop, const std::string& ownerName) {
// OptionProperty* p = static_cast<OptionProperty*>(prop);
// std::string name = p->guiName();
// int value = *p;
// std::vector<OptionProperty::Option> options = p->options();
// for (const OptionProperty::Option& o : options) {
// ImGui::RadioButton((ownerName + "." + name).c_str(), &value, o.value);
// ImGui::SameLine();
// ImGui::Text(o.description.c_str());
// }
// p->set(value);
//}
//void renderSelectionProperty(Property* prop, const std::string& ownerName) {
// SelectionProperty* p = static_cast<SelectionProperty*>(prop);
// std::string name = p->guiName();
// if (ImGui::CollapsingHeader((ownerName + "." + name).c_str())) {
// const std::vector<SelectionProperty::Option>& options = p->options();
// std::vector<int> newSelectedIndices;
// std::vector<int> selectedIndices = p->value();
// for (int i = 0; i < options.size(); ++i) {
// std::string description = options[i].description;
// bool selected = std::find(selectedIndices.begin(), selectedIndices.end(), i) != selectedIndices.end();
// ImGui::Checkbox(description.c_str(), &selected);
// if (selected)
// newSelectedIndices.push_back(i);
// }
// p->setValue(std::move(newSelectedIndices));
// }
//}
//void renderIntProperty(Property* prop, const std::string& ownerName) {
// IntProperty* p = static_cast<IntProperty*>(prop);
// std::string name = p->guiName();
// IntProperty::ValueType value = *p;
// ImGui::SliderInt((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue());
// p->set(value);
//}
//void renderFloatProperty(Property* prop, const std::string& ownerName) {
// FloatProperty* p = static_cast<FloatProperty*>(prop);
// std::string name = p->guiName();
// FloatProperty::ValueType value = *p;
// ImGui::SliderFloat((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue());
// p->set(value);
//}
//void renderVec2Property(Property* prop, const std::string& ownerName) {
// Vec2Property* p = static_cast<Vec2Property*>(prop);
// std::string name = p->guiName();
// Vec2Property::ValueType value = *p;
// ImGui::SliderFloat2((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
// p->set(value);
//}
//void renderVec3Property(Property* prop, const std::string& ownerName) {
// Vec3Property* p = static_cast<Vec3Property*>(prop);
// std::string name = p->guiName();
// Vec3Property::ValueType value = *p;
// ImGui::SliderFloat3((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
// p->set(value);
//}
//void renderTriggerProperty(Property* prop, const std::string& ownerName) {
// std::string name = prop->guiName();
// bool pressed = ImGui::Button((ownerName + "." + name).c_str());
// if (pressed)
// prop->set(0);
//}
}
namespace openspace {

View File

@@ -0,0 +1,286 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2016 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/onscreengui/include/renderproperties.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/selectionproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scripting/scriptengine.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/misc/assert.h>
#include "imgui.h"
using namespace openspace::properties;
void executeScript(const std::string& id, const std::string& value) {
std::string script =
"openspace.setPropertyValue('" + id + "', " + value + ");";
OsEng.scriptEngine().queueScript(script);
}
void renderBoolProperty(Property* prop) {
BoolProperty* p = static_cast<BoolProperty*>(prop);
std::string name = p->guiName();
BoolProperty::ValueType value = *p;
ImGui::Checkbox((name).c_str(), &value);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), value ? "true": "false");
}
void renderOptionProperty(Property* prop) {
OptionProperty* p = static_cast<OptionProperty*>(prop);
std::string name = p->guiName();
int value = *p;
std::vector<OptionProperty::Option> options = p->options();
for (const OptionProperty::Option& o : options) {
ImGui::RadioButton((name).c_str(), &value, o.value);
ImGui::SameLine();
ImGui::Text(o.description.c_str());
}
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderSelectionProperty(Property* prop) {
SelectionProperty* p = static_cast<SelectionProperty*>(prop);
std::string name = p->guiName();
if (ImGui::CollapsingHeader((name).c_str())) {
const std::vector<SelectionProperty::Option>& options = p->options();
std::vector<int> newSelectedIndices;
std::vector<int> selectedIndices = p->value();
for (int i = 0; i < options.size(); ++i) {
std::string description = options[i].description;
bool selected = std::find(selectedIndices.begin(), selectedIndices.end(), i) != selectedIndices.end();
ImGui::Checkbox(description.c_str(), &selected);
if (selected)
newSelectedIndices.push_back(i);
}
if (newSelectedIndices != p->value()) {
std::string parameters = "{";
for (int i : newSelectedIndices)
parameters += std::to_string(i) + ",";
parameters += "}";
executeScript(p->fullyQualifiedIdentifier(), parameters);
}
}
}
void renderStringProperty(Property* prop) {
StringProperty* p = static_cast<StringProperty*>(prop);
std::string name = p->guiName();
static const int bufferSize = 256;
static char buffer[bufferSize];
#ifdef _MSC_VER
strcpy_s(buffer, p->value().length() + 1, p->value().c_str());
#else
strcpy(buffer, p->value().c_str());
#endif
ImGui::InputText((name).c_str(), buffer, bufferSize);
std::string newValue(buffer);
if (newValue != p->value() && FileSys.fileExists(newValue))
executeScript(p->fullyQualifiedIdentifier(), "'" + newValue + "'");
}
void renderIntProperty(Property* prop) {
IntProperty* p = static_cast<IntProperty*>(prop);
std::string name = p->guiName();
IntProperty::ValueType value = *p;
ImGui::SliderInt((name).c_str(), &value, p->minValue(), p->maxValue());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderFloatProperty(Property* prop) {
FloatProperty* p = static_cast<FloatProperty*>(prop)
; std::string name = p->guiName();
FloatProperty::ValueType value = *p;
ImGui::SliderFloat((name).c_str(), &value, p->minValue(), p->maxValue());
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(), std::to_string(value));
}
void renderVec2Property(Property* prop) {
Vec2Property* p = static_cast<Vec2Property*>(prop);
std::string name = p->guiName();
Vec2Property::ValueType value = *p;
ImGui::SliderFloat2((name).c_str(), &value.x, std::min(p->minValue().x, p->minValue().y), std::max(p->maxValue().x, p->maxValue().y));
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," + std::to_string(value.y) + "}");
}
void renderVec3Property(Property* prop) {
Vec3Property* p = static_cast<Vec3Property*>(prop);
std::string name = p->guiName();
Vec3Property::ValueType value = *p;
ImGui::SliderFloat3((name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "}");
}
void renderVec4Property(Property* prop) {
Vec4Property* p = static_cast<Vec4Property*>(prop);
std::string name = p->guiName();
Vec4Property::ValueType value = *p;
ImGui::SliderFloat4((name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
if (value != p->value())
executeScript(p->fullyQualifiedIdentifier(),
"{" + std::to_string(value.x) + "," +
std::to_string(value.y) + "," +
std::to_string(value.z) + "," +
std::to_string(value.w) + "}");
}
void renderTriggerProperty(Property* prop) {
std::string name = prop->guiName();
bool pressed = ImGui::Button((name).c_str());
if (pressed)
executeScript(prop->fullyQualifiedIdentifier(), "nil");
}
//void renderBoolProperty(Property* prop, const std::string& ownerName) {
// BoolProperty* p = static_cast<BoolProperty*>(prop);
// std::string name = p->guiName();
// BoolProperty::ValueType value = *p;
// ImGui::Checkbox((ownerName + "." + name).c_str(), &value);
// p->set(value);
//}
//void renderOptionProperty(Property* prop, const std::string& ownerName) {
// OptionProperty* p = static_cast<OptionProperty*>(prop);
// std::string name = p->guiName();
// int value = *p;
// std::vector<OptionProperty::Option> options = p->options();
// for (const OptionProperty::Option& o : options) {
// ImGui::RadioButton((ownerName + "." + name).c_str(), &value, o.value);
// ImGui::SameLine();
// ImGui::Text(o.description.c_str());
// }
// p->set(value);
//}
//void renderSelectionProperty(Property* prop, const std::string& ownerName) {
// SelectionProperty* p = static_cast<SelectionProperty*>(prop);
// std::string name = p->guiName();
// if (ImGui::CollapsingHeader((ownerName + "." + name).c_str())) {
// const std::vector<SelectionProperty::Option>& options = p->options();
// std::vector<int> newSelectedIndices;
// std::vector<int> selectedIndices = p->value();
// for (int i = 0; i < options.size(); ++i) {
// std::string description = options[i].description;
// bool selected = std::find(selectedIndices.begin(), selectedIndices.end(), i) != selectedIndices.end();
// ImGui::Checkbox(description.c_str(), &selected);
// if (selected)
// newSelectedIndices.push_back(i);
// }
// p->setValue(std::move(newSelectedIndices));
// }
//}
//void renderIntProperty(Property* prop, const std::string& ownerName) {
// IntProperty* p = static_cast<IntProperty*>(prop);
// std::string name = p->guiName();
// IntProperty::ValueType value = *p;
// ImGui::SliderInt((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue());
// p->set(value);
//}
//void renderFloatProperty(Property* prop, const std::string& ownerName) {
// FloatProperty* p = static_cast<FloatProperty*>(prop);
// std::string name = p->guiName();
// FloatProperty::ValueType value = *p;
// ImGui::SliderFloat((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue());
// p->set(value);
//}
//void renderVec2Property(Property* prop, const std::string& ownerName) {
// Vec2Property* p = static_cast<Vec2Property*>(prop);
// std::string name = p->guiName();
// Vec2Property::ValueType value = *p;
// ImGui::SliderFloat2((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
// p->set(value);
//}
//void renderVec3Property(Property* prop, const std::string& ownerName) {
// Vec3Property* p = static_cast<Vec3Property*>(prop);
// std::string name = p->guiName();
// Vec3Property::ValueType value = *p;
// ImGui::SliderFloat3((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x);
// p->set(value);
//}
//void renderTriggerProperty(Property* prop, const std::string& ownerName) {
// std::string name = prop->guiName();
// bool pressed = ImGui::Button((ownerName + "." + name).c_str());
// if (pressed)
// prop->set(0);
//}