private void DrawDeltaTime() { EditorGUI.BeginDisabledGroup(!effectData_.byUserDeltaTime_); EditorGUILayout.BeginHorizontal(); GUILayout.Space(width_indent); EditorGUILayout.LabelField("Delta Time (secs)"); EditorGUI.EndDisabledGroup(); GUILayout.Space(20f); EditorGUILayout.LabelField("Last delta time"); EditorGUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(!effectData_.byUserDeltaTime_); EditorGUILayout.BeginHorizontal(); GUILayout.Space(width_indent); EditorGUI.BeginChangeCheck(); var deltaTime = CRGUIExtension.FloatTextField(effectData_.deltaTime_, 0.000001f, 10f, -1f, "undefined"); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(fxData_, "Change delta time - " + Data.Name); effectData_.deltaTime_ = deltaTime; EditorUtility.SetDirty(fxData_); } EditorGUI.EndDisabledGroup(); GUILayout.Space(20f); EditorGUILayout.LabelField((effectData_.calculatedDeltaTime_ < 0f) ? "not calculated yet" : effectData_.calculatedDeltaTime_.ToString(), EditorStyles.textField); EditorGUILayout.EndHorizontal(); }
private void DrawLength() { EditorGUI.BeginDisabledGroup(!effectData_.byUserCharacteristicObjectProperties_); EditorGUILayout.BeginHorizontal(); GUILayout.Space(width_indent); EditorGUILayout.LabelField("Length"); EditorGUI.EndDisabledGroup(); GUILayout.Space(20f); EditorGUILayout.LabelField("Last Length"); EditorGUILayout.EndHorizontal(); EditorGUI.BeginDisabledGroup(!effectData_.byUserCharacteristicObjectProperties_); EditorGUILayout.BeginHorizontal(); GUILayout.Space(width_indent); EditorGUI.BeginChangeCheck(); var length = CRGUIExtension.FloatTextField(effectData_.length_, 0f, 10f, -1f, "undefined"); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(fxData_, "Change length - " + Data.Name); effectData_.length_ = length; } EditorGUI.EndDisabledGroup(); GUILayout.Space(20f); EditorGUILayout.LabelField((effectData_.calculatedLength_ < 0f) ? "not calculated yet" : effectData_.calculatedLength_.ToString(), EditorStyles.textField); EditorGUILayout.EndHorizontal(); }
public static void CheckKeyPressedOrReset(string controlName, string currentFocusedControlName, Action action) { if (CRGUIExtension.KeyPressed(controlName, currentFocusedControlName, KeyCode.Return | KeyCode.KeypadEnter) || ((currentFocusedControlName != controlName))) { action(); } }
//---------------------------------------------------------------------------------- private void DrawTimeLength() { EditorGUI.BeginChangeCheck(); var timelengthValue = CRGUIExtension.FloatTextField("Time length", Data.TimeLength, 0.0f, 10000.0f, float.MaxValue, "-"); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(Data, "Change time length"); Data.TimeLength = timelengthValue; EditorUtility.SetDirty(Data); } }