public void Update(FEWorld world) { for (int iDraw = 0; iDraw < Drawers.Count; iDraw++) { IFieldDrawer drawer = Drawers[iDraw] as IFieldDrawer; drawer.Update(world); } }
public static void BeginFocusableField(IFieldDrawer subject, int controlID, ref int focusField, bool mixedContent) { BeginDataValidatedControls(subject); HandleFieldFocus(controlID, ref focusField); if (mixedContent) { DrawGUI.Active.ShowMixedValue = true; } }
public static void BeginInputField([NotNull] IFieldDrawer subject, int controlID, ref bool editField, ref int focusField, bool mixedContent) { #if DEV_MODE && PI_ASSERTATIONS Debug.Assert(subject != null); #endif BeginDataValidatedControls(subject); HandleFieldFocusAndStartEditing(controlID, ref editField, ref focusField); if (mixedContent) { DrawGUI.Active.ShowMixedValue = true; } }
public void DrawTableRow(FieldInfo field, IFieldDrawer drawer) { //Field type ImGui.TableSetColumnIndex(0); drawer.DrawType(field.FieldType); //Field name ImGui.TableSetColumnIndex(1); Caller.Try(() => { object instance = FieldReadable(field) ? field.GetValue(ClassInstance) : null; drawer.DrawName(field.Name, field.FieldType, ClassType, instance); }); //Field value if (FieldReadable(field)) { ImGui.TableSetColumnIndex(2); drawer.DrawFieldValue(field, ClassInstance); } }
private static void BeginDataValidatedControls(IFieldDrawer subject) { if (subject.ReadOnly) { beginDataValidatedControlsWasReadonly = true; guiWasEnabledBeforeBeginDataValidatedControls = GUI.enabled; GUI.enabled = false; } else { beginDataValidatedControlsWasReadonly = false; } var guiColorWas = GUI.color; GUIColorHistory.Push(guiColorWas); currentField = subject; #if UNITY_EDITOR var linkedFieldInfo = subject.MemberInfo; shouldEndProperty = false; if (linkedFieldInfo != null) { var serializedProperty = linkedFieldInfo.SerializedProperty; if (serializedProperty != null) { #if DEV_MODE && PI_ASSERTATIONS string s = "BeginProperty called for " + linkedFieldInfo; Debug.Assert(!linkedFieldInfo.IsStatic, s + " but it is static."); Debug.Assert(linkedFieldInfo.SerializedProperty.serializedObject != null, s + " but serializedObject was null."); Debug.Assert(linkedFieldInfo.SerializedProperty.serializedObject.targetObject != null, s + " but serializedObject.targetObject was null."); #endif EditorGUI.BeginProperty(subject.ControlPosition, GUIContent.none, serializedProperty); shouldEndProperty = true; } } #endif if (subject.IsAnimated) { //make animated fields update their values faster when animation is being played if (AnimationWindowUtility.Playing()) { subject.UpdateCachedValuesFromFieldsRecursively(); } } else if (!subject.DataIsValid) //UPDATE: using same red tint for controls animated in the Animation window too, at least for now { if (guiColorWas.r == 1f && guiColorWas.g == 1f && guiColorWas.b == 1f && guiColorWas.a == 1f) { GUI.color = Color.red; } else { var setGUIColor = Color.red; setGUIColor.r = (setGUIColor.r + guiColorWas.r) * 0.5f; setGUIColor.g = (setGUIColor.g + guiColorWas.g) * 0.5f; setGUIColor.b = (setGUIColor.b + guiColorWas.b) * 0.5f; setGUIColor.a = guiColorWas.a; GUI.color = setGUIColor; } } }
public static bool TryCreate(ShaderField field, MaterialProperty[] properties, out IFieldDrawer drawer) { var materialProperty = ShaderDrawerHelper.PublicFindProperty(field.ShaderFieldName, properties); if (materialProperty != null) { drawer = new StandardFieldDrawer(field, materialProperty); return(true); } else { drawer = default(IFieldDrawer); return(false); } }