Adjusted design of list on scripts and all numbers now use sliders
This commit is contained in:
parent
d6764b4551
commit
6dbda12f30
|
@ -165,8 +165,10 @@ namespace SHADE
|
||||||
if (isHovered)
|
if (isHovered)
|
||||||
*isHovered = ImGui::IsItemHovered();
|
*isHovered = ImGui::IsItemHovered();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
return ImGui::InputInt("##", &value,
|
return ImGui::DragInt("##", &value, 0.001f,
|
||||||
1, 10,
|
std::numeric_limits<int>::min(),
|
||||||
|
std::numeric_limits<int>::max(),
|
||||||
|
"%d",
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
}
|
}
|
||||||
bool SHEditorUI::InputUnsignedInt(const std::string& label, unsigned int& value, bool* isHovered)
|
bool SHEditorUI::InputUnsignedInt(const std::string& label, unsigned int& value, bool* isHovered)
|
||||||
|
@ -190,31 +192,22 @@ namespace SHADE
|
||||||
if (isHovered)
|
if (isHovered)
|
||||||
*isHovered = ImGui::IsItemHovered();
|
*isHovered = ImGui::IsItemHovered();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
return ImGui::InputFloat("##", &value,
|
return ImGui::DragFloat("##", &value, 0.001f,
|
||||||
0.1f, 1.0f, "%.3f",
|
std::numeric_limits<float>::lowest(),
|
||||||
|
std::numeric_limits<float>::max(),
|
||||||
|
"%.3f",
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||||
}
|
}
|
||||||
bool SHEditorUI::InputDouble(const std::string& label, double& value, bool* isHovered)
|
bool SHEditorUI::InputDouble(const std::string& label, double& value, bool* isHovered)
|
||||||
{
|
{
|
||||||
ImGui::Text(label.c_str());
|
float val = value;
|
||||||
if (isHovered)
|
const bool CHANGED = InputFloat(label, val, isHovered);
|
||||||
*isHovered = ImGui::IsItemHovered();
|
if (CHANGED)
|
||||||
ImGui::SameLine();
|
|
||||||
return ImGui::InputDouble("##", &value,
|
|
||||||
0.1, 1.0, "%.3f",
|
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
|
||||||
}
|
|
||||||
bool SHEditorUI::InputAngle(const std::string& label, double& value, bool* isHovered)
|
|
||||||
{
|
{
|
||||||
ImGui::Text(label.c_str());
|
value = static_cast<double>(val);
|
||||||
if (isHovered)
|
}
|
||||||
*isHovered = ImGui::IsItemHovered();
|
return CHANGED;
|
||||||
ImGui::SameLine();
|
|
||||||
return ImGui::InputDouble("##", &value,
|
|
||||||
1.0, 45.0, "%.3f",
|
|
||||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SHEditorUI::InputSlider(const std::string& label, int min, int max, int& value, bool* isHovered /*= nullptr*/)
|
bool SHEditorUI::InputSlider(const std::string& label, int min, int max, int& value, bool* isHovered /*= nullptr*/)
|
||||||
{
|
{
|
||||||
ImGui::Text(label.c_str());
|
ImGui::Text(label.c_str());
|
||||||
|
|
|
@ -219,17 +219,6 @@ namespace SHADE
|
||||||
/// <returns>True if the value was changed.</returns>
|
/// <returns>True if the value was changed.</returns>
|
||||||
static bool InputDouble(const std::string& label, double& value, bool* isHovered = nullptr);
|
static bool InputDouble(const std::string& label, double& value, bool* isHovered = nullptr);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a decimal field widget for double input with increments of higher
|
|
||||||
/// steps meant for angle variables.
|
|
||||||
/// <br/>
|
|
||||||
/// Wraps up ImGui::InputDouble().
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="label">Label used to identify this widget.</param>
|
|
||||||
/// <param name="value">Reference to the variable to store the result.</param>
|
|
||||||
/// <param name="isHovered>If set, stores the hover state of this widget.</param>
|
|
||||||
/// <returns>True if the value was changed.</returns>
|
|
||||||
static bool InputAngle(const std::string& label, double& value, bool* isHovered = nullptr);
|
|
||||||
/// <summary>
|
|
||||||
/// Creates an int slider field widget for double input.
|
/// Creates an int slider field widget for double input.
|
||||||
/// <br/>
|
/// <br/>
|
||||||
/// Wraps up ImGui::SliderInt().
|
/// Wraps up ImGui::SliderInt().
|
||||||
|
|
|
@ -178,17 +178,14 @@ namespace SHADE
|
||||||
RangeAttribute^ rangeAttrib = hasAttribute<RangeAttribute^>(field);
|
RangeAttribute^ rangeAttrib = hasAttribute<RangeAttribute^>(field);
|
||||||
System::Collections::IList^ iList = safe_cast<System::Collections::IList^>(field->GetValue(object));
|
System::Collections::IList^ iList = safe_cast<System::Collections::IList^>(field->GetValue(object));
|
||||||
|
|
||||||
SHEditorUI::Text(Convert::ToNative(field->Name));
|
if (SHEditorUI::CollapsingHeader(Convert::ToNative(field->Name)))
|
||||||
SHEditorUI::SameLine();
|
{
|
||||||
|
if (SHEditorUI::Button("Add Item"))
|
||||||
if (SHEditorUI::Button("+"))
|
|
||||||
{
|
{
|
||||||
System::Object^ obj = System::Activator::CreateInstance(listType);
|
System::Object^ obj = System::Activator::CreateInstance(listType);
|
||||||
iList->Add(obj);
|
iList->Add(obj);
|
||||||
registerUndoListAddAction(listType, iList, iList->Count - 1, obj);
|
registerUndoListAddAction(listType, iList, iList->Count - 1, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHEditorUI::Indent();
|
|
||||||
for (int i = 0; i < iList->Count; ++i)
|
for (int i = 0; i < iList->Count; ++i)
|
||||||
{
|
{
|
||||||
SHEditorUI::PushID(i);
|
SHEditorUI::PushID(i);
|
||||||
|
@ -210,7 +207,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
SHEditorUI::PopID();
|
SHEditorUI::PopID();
|
||||||
}
|
}
|
||||||
SHEditorUI::Unindent();
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue