public override void OnInspectorGUI() { base.OnInspectorGUI(); try { bool passThroughChanged = false; EditorGUI.BeginChangeCheck(); { EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(passThroughProp); } if (EditorGUI.EndChangeCheck()) { passThroughChanged = true; } if (!passThroughProp.boolValue) { EditorGUILayout.PropertyField(operationProp); } } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); if (passThroughChanged) { foreach (var target in serializedObject.targetObjects) { var operation = target as ChiselOperation; if (!operation) { continue; } ChiselNodeHierarchyManager.UpdateAvailability(operation); } } } bool hasNoChildren = false; foreach (var target in serializedObject.targetObjects) { var operation = target as ChiselOperation; if (!operation) { continue; } if (operation.transform.childCount == 0) { hasNoChildren = true; } } if (hasNoChildren) { EditorGUILayout.HelpBox(kOperationHasNoChildren, MessageType.Warning, true); } } catch (ExitGUIException) { } catch (Exception ex) { Debug.LogException(ex); } }
protected virtual void OnDisable() { // Note: cannot call OnCleanup here ChiselNodeHierarchyManager.UpdateAvailability(this); }
protected void OnEnable() { OnInitialize(); // Awake is not reliable, so we initialize here ChiselNodeHierarchyManager.UpdateAvailability(this); }
public override void OnInspectorGUI() { if (!target) { return; } Profiler.BeginSample("OnInspectorGUI"); base.OnInspectorGUI(); try { bool passThroughChanged = false; EditorGUI.BeginChangeCheck(); { EditorGUI.BeginChangeCheck(); { EditorGUILayout.PropertyField(passThroughProp); } if (EditorGUI.EndChangeCheck()) { passThroughChanged = true; } if (!passThroughProp.boolValue) { EditorGUILayout.PropertyField(operationProp); } } if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); if (passThroughChanged) { foreach (var target in serializedObject.targetObjects) { var composite = target as ChiselComposite; if (!composite) { continue; } ChiselNodeHierarchyManager.UpdateAvailability(composite); } } OnShapeChanged(target as ChiselComposite); } bool hasNoChildren = false; foreach (var target in serializedObject.targetObjects) { var composite = target as ChiselComposite; if (!composite) { continue; } if (composite.transform.childCount == 0) { hasNoChildren = true; } } if (hasNoChildren) { EditorGUILayout.HelpBox(kCompositeHasNoChildren, MessageType.Warning, true); } } catch (ExitGUIException) { } catch (Exception ex) { Debug.LogException(ex); } finally { Profiler.EndSample(); } }