(ContentItem contentItem, Actor actor, Windows.Assets.PrefabWindow prefabWindow)
| 133 | } |
| 134 | |
| 135 | private void OnPrefabCreated(ContentItem contentItem, Actor actor, Windows.Assets.PrefabWindow prefabWindow) |
| 136 | { |
| 137 | if (contentItem is PrefabItem prefabItem) |
| 138 | { |
| 139 | PrefabCreated?.Invoke(prefabItem); |
| 140 | } |
| 141 | |
| 142 | Undo undo = null; |
| 143 | if (prefabWindow != null) |
| 144 | { |
| 145 | prefabWindow.MarkAsEdited(); |
| 146 | undo = prefabWindow.Undo; |
| 147 | } |
| 148 | else |
| 149 | { |
| 150 | // Skip in invalid states |
| 151 | if (!Editor.StateMachine.CurrentState.CanEditScene) |
| 152 | return; |
| 153 | undo = Editor.Undo; |
| 154 | Editor.Scene.MarkSceneEdited(actor.Scene); |
| 155 | } |
| 156 | |
| 157 | // Record undo for prefab creating (backend links the target instance with the prefab) |
| 158 | if (undo.Enabled) |
| 159 | { |
| 160 | if (!actor) |
| 161 | return; |
| 162 | var actorsList = new List<Actor>(); |
| 163 | Utilities.Utils.GetActorsTree(actorsList, actor); |
| 164 | |
| 165 | var actions = new IUndoAction[actorsList.Count]; |
| 166 | for (int i = 0; i < actorsList.Count; i++) |
| 167 | actions[i] = BreakPrefabLinkAction.Linked(actorsList[i]); |
| 168 | undo.AddAction(new MultiUndoAction(actions)); |
| 169 | } |
| 170 | |
| 171 | Editor.Windows.PropertiesWin.Presenter.BuildLayout(); |
| 172 | if (prefabWindow != null) |
| 173 | prefabWindow.Presenter.BuildLayout(); |
| 174 | } |
| 175 | |
| 176 | /// <summary> |
| 177 | /// Breaks any prefab links for the selected objects. Supports undo/redo. |
nothing calls this directly
no test coverage detected