From ea5006f9c63fe85eed25af95e0d766bd601c478b Mon Sep 17 00:00:00 2001 From: Michael Nilsson Date: Fri, 6 May 2016 17:21:48 -0400 Subject: [PATCH] removee displaying propery owner name from gui properties --- modules/base/rendering/screenspaceimage.cpp | 1 - modules/onscreengui/src/guiiswacomponent.cpp | 60 +++++++++---------- .../onscreengui/src/guipropertycomponent.cpp | 60 +++++++++---------- 3 files changed, 60 insertions(+), 61 deletions(-) diff --git a/modules/base/rendering/screenspaceimage.cpp b/modules/base/rendering/screenspaceimage.cpp index 88c5a4ba72..001b579563 100644 --- a/modules/base/rendering/screenspaceimage.cpp +++ b/modules/base/rendering/screenspaceimage.cpp @@ -182,7 +182,6 @@ void ScreenSpaceImage::updateTexture(){ } } - std::future ScreenSpaceImage::downloadImageToMemory(std::string url){ return std::move( DlManager.fetchFile( url, diff --git a/modules/onscreengui/src/guiiswacomponent.cpp b/modules/onscreengui/src/guiiswacomponent.cpp index 3b10beac4a..b4b72073ee 100644 --- a/modules/onscreengui/src/guiiswacomponent.cpp +++ b/modules/onscreengui/src/guiiswacomponent.cpp @@ -53,25 +53,25 @@ namespace { OsEng.scriptEngine().queueScript(script); } - void renderBoolProperty(Property* prop, const std::string& ownerName) { + void renderBoolProperty(Property* prop) { BoolProperty* p = static_cast(prop); std::string name = p->guiName(); BoolProperty::ValueType value = *p; - ImGui::Checkbox((ownerName + "." + name).c_str(), &value); + ImGui::Checkbox((name).c_str(), &value); if (value != p->value()) executeScript(p->fullyQualifiedIdentifier(), value ? "true": "false"); } - void renderOptionProperty(Property* prop, const std::string& ownerName) { + void renderOptionProperty(Property* prop) { OptionProperty* p = static_cast(prop); std::string name = p->guiName(); int value = *p; std::vector options = p->options(); for (const OptionProperty::Option& o : options) { - ImGui::RadioButton((ownerName + "." + name).c_str(), &value, o.value); + ImGui::RadioButton((name).c_str(), &value, o.value); ImGui::SameLine(); ImGui::Text(o.description.c_str()); } @@ -79,11 +79,11 @@ namespace { executeScript(p->fullyQualifiedIdentifier(), std::to_string(value)); } - void renderSelectionProperty(Property* prop, const std::string& ownerName) { + void renderSelectionProperty(Property* prop) { SelectionProperty* p = static_cast(prop); std::string name = p->guiName(); - if (ImGui::CollapsingHeader((ownerName + "." + name).c_str())) { + if (ImGui::CollapsingHeader((name).c_str())) { const std::vector& options = p->options(); std::vector newSelectedIndices; @@ -108,7 +108,7 @@ namespace { } } - void renderStringProperty(Property* prop, const std::string& ownerName) { + void renderStringProperty(Property* prop) { StringProperty* p = static_cast(prop); std::string name = p->guiName(); @@ -119,56 +119,56 @@ namespace { #else strcpy(buffer, p->value().c_str()); #endif - ImGui::InputText((ownerName + "." + name).c_str(), buffer, bufferSize); + 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, const std::string& ownerName) { + void renderIntProperty(Property* prop) { IntProperty* p = static_cast(prop); std::string name = p->guiName(); IntProperty::ValueType value = *p; - ImGui::SliderInt((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue()); + 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, const std::string& ownerName) { + void renderFloatProperty(Property* prop) { FloatProperty* p = static_cast(prop); std::string name = p->guiName(); FloatProperty::ValueType value = *p; - ImGui::SliderFloat((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue()); + 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, const std::string& ownerName) { + void renderVec2Property(Property* prop) { Vec2Property* p = static_cast(prop); std::string name = p->guiName(); Vec2Property::ValueType value = *p; - ImGui::SliderFloat2((ownerName + "." + name).c_str(), &value.x, std::min(p->minValue().x, p->minValue().y), std::max(p->maxValue().x, p->maxValue().y)); + 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, const std::string& ownerName) { + void renderVec3Property(Property* prop) { Vec3Property* p = static_cast(prop); std::string name = p->guiName(); Vec3Property::ValueType value = *p; - ImGui::SliderFloat3((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); + ImGui::SliderFloat3((name).c_str(), &value.x, p->minValue().x, p->maxValue().x); if (value != p->value()) executeScript(p->fullyQualifiedIdentifier(), @@ -177,13 +177,13 @@ namespace { std::to_string(value.z) + "}"); } - void renderVec4Property(Property* prop, const std::string& ownerName) { + void renderVec4Property(Property* prop) { Vec4Property* p = static_cast(prop); std::string name = p->guiName(); Vec4Property::ValueType value = *p; - ImGui::SliderFloat4((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); + ImGui::SliderFloat4((name).c_str(), &value.x, p->minValue().x, p->maxValue().x); if (value != p->value()) executeScript(p->fullyQualifiedIdentifier(), @@ -193,9 +193,9 @@ namespace { std::to_string(value.w) + "}"); } - void renderTriggerProperty(Property* prop, const std::string& ownerName) { + void renderTriggerProperty(Property* prop) { std::string name = prop->guiName(); - bool pressed = ImGui::Button((ownerName + "." + name).c_str()); + bool pressed = ImGui::Button((name).c_str()); if (pressed) executeScript(prop->fullyQualifiedIdentifier(), "nil"); } @@ -266,52 +266,52 @@ void GuiISWAComponent::render() { if (ImGui::CollapsingHeader(p.first.c_str())) { for (properties::Property* prop : p.second) { if (_boolProperties.find(prop) != _boolProperties.end()) { - renderBoolProperty(prop, p.first); + renderBoolProperty(prop); continue; } if (_intProperties.find(prop) != _intProperties.end()) { - renderIntProperty(prop, p.first); + renderIntProperty(prop); continue; } if (_floatProperties.find(prop) != _floatProperties.end()) { - renderFloatProperty(prop, p.first); + renderFloatProperty(prop); continue; } if (_vec2Properties.find(prop) != _vec2Properties.end()) { - renderVec2Property(prop, p.first); + renderVec2Property(prop); continue; } if (_vec3Properties.find(prop) != _vec3Properties.end()) { - renderVec3Property(prop, p.first); + renderVec3Property(prop); continue; } if (_vec4Properties.find(prop) != _vec4Properties.end()) { - renderVec4Property(prop, p.first); + renderVec4Property(prop); continue; } if (_optionProperties.find(prop) != _optionProperties.end()) { - renderOptionProperty(prop, p.first); + renderOptionProperty(prop); continue; } if (_triggerProperties.find(prop) != _triggerProperties.end()) { - renderTriggerProperty(prop, p.first); + renderTriggerProperty(prop); continue; } if (_selectionProperties.find(prop) != _selectionProperties.end()) { - renderSelectionProperty(prop, p.first); + renderSelectionProperty(prop); continue; } if (_stringProperties.find(prop) != _stringProperties.end()) { - renderStringProperty(prop, p.first); + renderStringProperty(prop); continue; } } diff --git a/modules/onscreengui/src/guipropertycomponent.cpp b/modules/onscreengui/src/guipropertycomponent.cpp index 708d3e31b9..c041be9520 100644 --- a/modules/onscreengui/src/guipropertycomponent.cpp +++ b/modules/onscreengui/src/guipropertycomponent.cpp @@ -51,25 +51,25 @@ namespace { OsEng.scriptEngine().queueScript(script); } - void renderBoolProperty(Property* prop, const std::string& ownerName) { + void renderBoolProperty(Property* prop) { BoolProperty* p = static_cast(prop); std::string name = p->guiName(); BoolProperty::ValueType value = *p; - ImGui::Checkbox((ownerName + "." + name).c_str(), &value); + ImGui::Checkbox((name).c_str(), &value); if (value != p->value()) executeScript(p->fullyQualifiedIdentifier(), value ? "true": "false"); } - void renderOptionProperty(Property* prop, const std::string& ownerName) { + void renderOptionProperty(Property* prop) { OptionProperty* p = static_cast(prop); std::string name = p->guiName(); int value = *p; std::vector options = p->options(); for (const OptionProperty::Option& o : options) { - ImGui::RadioButton((ownerName + "." + name).c_str(), &value, o.value); + ImGui::RadioButton((name).c_str(), &value, o.value); ImGui::SameLine(); ImGui::Text(o.description.c_str()); } @@ -77,11 +77,11 @@ namespace { executeScript(p->fullyQualifiedIdentifier(), std::to_string(value)); } - void renderSelectionProperty(Property* prop, const std::string& ownerName) { + void renderSelectionProperty(Property* prop) { SelectionProperty* p = static_cast(prop); std::string name = p->guiName(); - if (ImGui::CollapsingHeader((ownerName + "." + name).c_str())) { + if (ImGui::CollapsingHeader((name).c_str())) { const std::vector& options = p->options(); std::vector newSelectedIndices; @@ -106,7 +106,7 @@ namespace { } } - void renderStringProperty(Property* prop, const std::string& ownerName) { + void renderStringProperty(Property* prop) { StringProperty* p = static_cast(prop); std::string name = p->guiName(); @@ -117,56 +117,56 @@ namespace { #else strcpy(buffer, p->value().c_str()); #endif - ImGui::InputText((ownerName + "." + name).c_str(), buffer, bufferSize); + 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, const std::string& ownerName) { + void renderIntProperty(Property* prop) { IntProperty* p = static_cast(prop); std::string name = p->guiName(); IntProperty::ValueType value = *p; - ImGui::SliderInt((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue()); + 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, const std::string& ownerName) { + void renderFloatProperty(Property* prop) { FloatProperty* p = static_cast(prop); std::string name = p->guiName(); FloatProperty::ValueType value = *p; - ImGui::SliderFloat((ownerName + "." + name).c_str(), &value, p->minValue(), p->maxValue()); + 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, const std::string& ownerName) { + void renderVec2Property(Property* prop) { Vec2Property* p = static_cast(prop); std::string name = p->guiName(); Vec2Property::ValueType value = *p; - ImGui::SliderFloat2((ownerName + "." + name).c_str(), &value.x, std::min(p->minValue().x, p->minValue().y), std::max(p->maxValue().x, p->maxValue().y)); + 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, const std::string& ownerName) { + void renderVec3Property(Property* prop) { Vec3Property* p = static_cast(prop); std::string name = p->guiName(); Vec3Property::ValueType value = *p; - ImGui::SliderFloat3((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); + ImGui::SliderFloat3((name).c_str(), &value.x, p->minValue().x, p->maxValue().x); if (value != p->value()) executeScript(p->fullyQualifiedIdentifier(), @@ -175,13 +175,13 @@ namespace { std::to_string(value.z) + "}"); } - void renderVec4Property(Property* prop, const std::string& ownerName) { + void renderVec4Property(Property* prop) { Vec4Property* p = static_cast(prop); std::string name = p->guiName(); Vec4Property::ValueType value = *p; - ImGui::SliderFloat4((ownerName + "." + name).c_str(), &value.x, p->minValue().x, p->maxValue().x); + ImGui::SliderFloat4((name).c_str(), &value.x, p->minValue().x, p->maxValue().x); if (value != p->value()) executeScript(p->fullyQualifiedIdentifier(), @@ -191,9 +191,9 @@ namespace { std::to_string(value.w) + "}"); } - void renderTriggerProperty(Property* prop, const std::string& ownerName) { + void renderTriggerProperty(Property* prop) { std::string name = prop->guiName(); - bool pressed = ImGui::Button((ownerName + "." + name).c_str()); + bool pressed = ImGui::Button((name).c_str()); if (pressed) executeScript(prop->fullyQualifiedIdentifier(), "nil"); } @@ -537,52 +537,52 @@ void GuiPropertyComponent::render() { if (ImGui::CollapsingHeader(p.first.c_str())) { for (properties::Property* prop : p.second) { if (_boolProperties.find(prop) != _boolProperties.end()) { - renderBoolProperty(prop, p.first); + renderBoolProperty(prop); continue; } if (_intProperties.find(prop) != _intProperties.end()) { - renderIntProperty(prop, p.first); + renderIntProperty(prop); continue; } if (_floatProperties.find(prop) != _floatProperties.end()) { - renderFloatProperty(prop, p.first); + renderFloatProperty(prop); continue; } if (_vec2Properties.find(prop) != _vec2Properties.end()) { - renderVec2Property(prop, p.first); + renderVec2Property(prop); continue; } if (_vec3Properties.find(prop) != _vec3Properties.end()) { - renderVec3Property(prop, p.first); + renderVec3Property(prop); continue; } if (_vec4Properties.find(prop) != _vec4Properties.end()) { - renderVec4Property(prop, p.first); + renderVec4Property(prop); continue; } if (_optionProperties.find(prop) != _optionProperties.end()) { - renderOptionProperty(prop, p.first); + renderOptionProperty(prop); continue; } if (_triggerProperties.find(prop) != _triggerProperties.end()) { - renderTriggerProperty(prop, p.first); + renderTriggerProperty(prop); continue; } if (_selectionProperties.find(prop) != _selectionProperties.end()) { - renderSelectionProperty(prop, p.first); + renderSelectionProperty(prop); continue; } if (_stringProperties.find(prop) != _stringProperties.end()) { - renderStringProperty(prop, p.first); + renderStringProperty(prop); continue; } }