Added exposed var bool + fixed transform panel

This commit is contained in:
antopilo
2024-10-19 15:02:36 -04:00
parent 39cf28c91e
commit c432077328
2 changed files with 11 additions and 7 deletions

View File

@@ -215,10 +215,14 @@ void NetScriptPanel::Draw(Nuake::Entity& entity, entt::meta_any& componentInstan
field.Value = field.DefaultValue;
}
bool currentValue = std::any_cast<bool>(field.Value);
const std::string sliderName = "##" + field.Name + "slider";
ImGui::Checkbox(sliderName.c_str(), &currentValue);
field.Value = currentValue;
auto typeName = field.Value.type().name();
if (typeName == std::string("bool"))
{
bool currentValue = std::any_cast<bool>(field.Value);
const std::string sliderName = "##" + field.Name + "slider";
ImGui::Checkbox(sliderName.c_str(), &currentValue);
field.Value = currentValue;
}
}
if (field.Type == Nuake::NetScriptExposedVarType::String)

View File

@@ -27,7 +27,7 @@ public:
ImGui::TableNextColumn();
Vector3 position = component.GetLocalPosition();
ImGuiHelper::DrawVec3("Translation##" + entity.GetHandle(), &position);
ImGuiHelper::DrawVec3("Translation##" + std::to_string(entity.GetHandle()), &position);
if (position != component.GetLocalPosition())
component.SetLocalPosition(position);
@@ -52,7 +52,7 @@ public:
Vector3 eulerDegreesOld = glm::degrees(glm::eulerAngles(currentRotation));
// Draw the ImGui widget for rotation
ImGuiHelper::DrawVec3("Rotation##" + entity.GetHandle(), &eulerDegreesOld);
ImGuiHelper::DrawVec3("Rotation##" + std::to_string(entity.GetHandle()), &eulerDegreesOld);
// Calculate the delta in Euler angles
Vector3 eulerDelta = eulerDegreesOld - glm::degrees(glm::eulerAngles(currentRotation));
@@ -97,7 +97,7 @@ public:
ImGui::TableNextColumn();
Vector3 localScale = component.GetLocalScale();
ImGuiHelper::DrawVec3("Scale##" + entity.GetHandle(), &localScale);
ImGuiHelper::DrawVec3("Scale##" + std::to_string(entity.GetHandle()), &localScale);
if (localScale != component.GetLocalScale())
component.SetLocalScale(localScale);