Added tooltip and range attribute support for lists in scripts
This commit is contained in:
parent
6dbda12f30
commit
24dcd77f32
|
@ -18,7 +18,9 @@ public class RaccoonShowcase : Script
|
||||||
private double rotation = 0.0;
|
private double rotation = 0.0;
|
||||||
private Vector3 scale = Vector3.Zero;
|
private Vector3 scale = Vector3.Zero;
|
||||||
private double originalScale = 1.0f;
|
private double originalScale = 1.0f;
|
||||||
|
[Tooltip("Sample list of Vector3s.")]
|
||||||
public List<Vector3> vecList = new List<Vector3>(new Vector3[] { new Vector3(1, 2, 3), new Vector3(4, 5, 6) });
|
public List<Vector3> vecList = new List<Vector3>(new Vector3[] { new Vector3(1, 2, 3), new Vector3(4, 5, 6) });
|
||||||
|
[Range(-5, 5)]
|
||||||
public List<int> intList = new List<int>(new int[] { 2, 8, 2, 6, 8, 0, 1 });
|
public List<int> intList = new List<int>(new int[] { 2, 8, 2, 6, 8, 0, 1 });
|
||||||
public List<Light.Type> enumList = new List<Light.Type>(new Light.Type[] { Light.Type.Point, Light.Type.Directional, Light.Type.Ambient });
|
public List<Light.Type> enumList = new List<Light.Type>(new Light.Type[] { Light.Type.Point, Light.Type.Directional, Light.Type.Ambient });
|
||||||
public RaccoonShowcase(GameObject gameObj) : base(gameObj) {}
|
public RaccoonShowcase(GameObject gameObj) : base(gameObj) {}
|
||||||
|
|
|
@ -53,9 +53,12 @@ namespace SHADE
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
/* ImGui Wrapper Functions - Organizers */
|
/* ImGui Wrapper Functions - Organizers */
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
bool SHEditorUI::CollapsingHeader(const std::string& title)
|
bool SHEditorUI::CollapsingHeader(const std::string& title, bool* isHovered)
|
||||||
{
|
{
|
||||||
return ImGui::CollapsingHeader(title.c_str(), ImGuiTreeNodeFlags_DefaultOpen);
|
const bool OPENED = ImGui::CollapsingHeader(title.c_str(), ImGuiTreeNodeFlags_DefaultOpen);
|
||||||
|
if (isHovered)
|
||||||
|
*isHovered = ImGui::IsItemHovered();
|
||||||
|
return OPENED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHEditorUI::SameLine()
|
void SHEditorUI::SameLine()
|
||||||
|
|
|
@ -85,8 +85,9 @@ namespace SHADE
|
||||||
/// Wraps up ImGui::CollapsingHeader().
|
/// Wraps up ImGui::CollapsingHeader().
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="title">Label for the header.</param>
|
/// <param name="title">Label for the header.</param>
|
||||||
|
/// <param name="isHovered>If set, stores the hover state of this widget.</param>
|
||||||
/// <returns>True if the header is open, false otherwise.</returns>
|
/// <returns>True if the header is open, false otherwise.</returns>
|
||||||
static bool CollapsingHeader(const std::string& title);
|
static bool CollapsingHeader(const std::string& title, bool* isHovered = nullptr);
|
||||||
static void SameLine();
|
static void SameLine();
|
||||||
static void Separator();
|
static void Separator();
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@ 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));
|
||||||
|
|
||||||
if (SHEditorUI::CollapsingHeader(Convert::ToNative(field->Name)))
|
if (SHEditorUI::CollapsingHeader(Convert::ToNative(field->Name), &isHovered))
|
||||||
{
|
{
|
||||||
if (SHEditorUI::Button("Add Item"))
|
if (SHEditorUI::Button("Add Item"))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue