Added exposed var bool + fixed transform panel
This commit is contained in:
@@ -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(), ¤tValue);
|
||||
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(), ¤tValue);
|
||||
field.Value = currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (field.Type == Nuake::NetScriptExposedVarType::String)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user