diff --git a/Scripts/Brushes/CompoundBrushes/ShapeEditor/ShapeEditorBrush.cs b/Scripts/Brushes/CompoundBrushes/ShapeEditor/ShapeEditorBrush.cs index 6a8a35ab..4b87b8f4 100644 --- a/Scripts/Brushes/CompoundBrushes/ShapeEditor/ShapeEditorBrush.cs +++ b/Scripts/Brushes/CompoundBrushes/ShapeEditor/ShapeEditorBrush.cs @@ -284,6 +284,18 @@ public override void Invalidate(bool polygonsChanged) UpdateGeneratedHierarchyName(); } + /// + /// Called when undo or redo is performed in the editor. + /// + public override void OnUndoRedoPerformed() + { + // reset our cached polygon data. + isDirty = true; + m_LastBuiltPolygons = null; + // the base method will invalidate this compound brush. + base.OnUndoRedoPerformed(); + } + /// /// Gets the next segment. /// @@ -683,6 +695,9 @@ public Project GetEmbeddedProject() /// The project to be copied into the brush. public void CreatePolygon(Project project) { +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(this, "Create Polygon"); +#endif // store a project copy inside of this brush. this.project = project.Clone(); // store the extrude mode inside of this brush. @@ -700,6 +715,9 @@ public void CreatePolygon(Project project) /// The project to be copied into the brush. public void RevolveShape(Project project) { +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(this, "Revolve Shape"); +#endif // store a project copy inside of this brush. this.project = project.Clone(); // store the extrude mode inside of this brush. @@ -717,6 +735,9 @@ public void RevolveShape(Project project) /// The project to be copied into the brush. public void ExtrudeShape(Project project) { +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(this, "Extrude Shape"); +#endif // store a project copy inside of this brush. this.project = project.Clone(); // store the extrude mode inside of this brush. @@ -734,6 +755,9 @@ public void ExtrudeShape(Project project) /// The project to be copied into the brush. public void ExtrudePoint(Project project) { +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(this, "Extrude Point"); +#endif // store a project copy inside of this brush. this.project = project.Clone(); // store the extrude mode inside of this brush. @@ -752,6 +776,9 @@ public void ExtrudePoint(Project project) /// The project to be copied into the brush. public void ExtrudeBevel(Project project) { +#if UNITY_EDITOR + UnityEditor.Undo.RecordObject(this, "Extrude Bevel"); +#endif // if the depth and clip depth are identical, extrude a point instead. if (project.extrudeDepth.EqualsWithEpsilon(project.extrudeClipDepth)) {