/// Draws a field from cache info. protected void DrawField(ReflectionCache.CachedPropertyInfo info, object target, bool withLabel) { if (filter_.IsActive && !filter_.PassFilter(info.DisplayName)) { return; } Type pType = info.Type; if (pType != typeof(bool) && withLabel) { ImGuiCli.Text(info.DisplayName); if (!string.IsNullOrWhiteSpace(info.Tip))// && ImGuiCli.IsItemHovered()) { ImGuiCli.SameLine(); ImGuiCli.Text(ICON_FA.INFO_CIRCLE); if (ImGuiCli.IsItemHovered()) { ImGuiCli.SetTooltip(info.Tip); } } } string labelLessName = "##" + info.DisplayName; if (pType == typeof(bool)) { bool value = (bool)info.GetValue(target); string lbl = withLabel ? info.DisplayName : "##" + info.DisplayName; if (ImGuiCli.Checkbox(lbl, ref value)) { info.SetValue(target, value); } if (!string.IsNullOrWhiteSpace(info.Tip) && ImGuiCli.IsItemHovered()) { ImGuiCli.SetTooltip(info.Tip); } } else if (pType == typeof(int)) { int value = (int)info.GetValue(target); if (ImGuiCli.DragInt(labelLessName, ref value)) { info.SetValue(target, value); } } else if (pType == typeof(uint)) { int value = (int)info.GetValue(target); if (ImGuiCli.DragInt(labelLessName, ref value, 1, 0, int.MaxValue)) { info.SetValue(target, (int)value); } } else if (pType == typeof(float)) { float value = (float)info.GetValue(target); if (ImGuiCli.DragFloat(labelLessName, ref value)) { info.SetValue(target, value); } } else if (pType == typeof(double)) { float value = (float)info.GetValue(target); if (ImGuiCli.DragFloat(labelLessName, ref value)) { info.SetValue(target, (double)value); } } else if (pType == typeof(string)) { string value = (string)info.GetValue(target); if (value == null) { value = ""; } if (ImGuiCli.InputText(labelLessName, ref value)) { info.SetValue(target, value); } } else if (pType == typeof(Color)) { Color value = (Color)info.GetValue(target); if (ImGuiCli.InputColor(labelLessName, ref value)) { info.SetValue(target, value); } } else if (pType == typeof(Vector2)) { Vector2 value = (Vector2)info.GetValue(target); if (ImGuiEx.DragFloatN_Colored(labelLessName, ref value)) { info.SetValue(target, value); } } else if (pType == typeof(Vector3)) { Vector3 value = (Vector3)info.GetValue(target); if (ImGuiEx.DragFloatN_Colored(labelLessName, ref value)) { info.SetValue(target, value); } } else if (pType == typeof(Vector4)) { if (info.EditType == PropertyData.EditorType.Color) { Vector4 value = (Vector4)info.GetValue(target); if (ImGuiCli.InputColor(labelLessName, ref value)) { info.SetValue(target, value); } } else { Vector4 value = (Vector4)info.GetValue(target); if (ImGuiCli.DragFloat4(labelLessName, ref value)) { info.SetValue(target, value); } } } else if (pType == typeof(Matrix)) { if (info.EditType == PropertyData.EditorType.Transform) { Matrix value = (Matrix)info.GetValue(target); if (ImGuiEx.MatrixTransform(ref value, true)) { info.SetValue(target, value); } } else { Matrix value = (Matrix)info.GetValue(target); if (ImGuiEx.DragMatrix(ref value)) { info.SetValue(target, value); } } } else if (pType.IsEnum) { int value = (int)info.GetValue(target); if (ImGuiCli.Combo(labelLessName, ref value, info.enumNames)) { info.SetValue(target, Enum.GetValues(info.Type).GetValue(value)); } } else { PropertyData.ImPropertyHandler foundHandler = null; if (reflectCache_.TypeHandlers.TryGetValue(pType, out foundHandler)) { foundHandler.EmitUI(info, target); } } }