Refactor UI Control linkage in the prefab previews to prevent bugs
This commit is contained in:
@@ -290,7 +290,6 @@ namespace FlaxEditor
|
||||
|
||||
StateMachine = new EditorStateMachine(this);
|
||||
Undo = new EditorUndo(this);
|
||||
UIControl.FallbackParentGetDelegate += OnUIControlFallbackParentGet;
|
||||
|
||||
if (newProject)
|
||||
InitProject();
|
||||
@@ -355,27 +354,6 @@ namespace FlaxEditor
|
||||
StateMachine.LoadingState.StartInitEnding(skipCompile);
|
||||
}
|
||||
|
||||
private ContainerControl OnUIControlFallbackParentGet(UIControl control)
|
||||
{
|
||||
// Check if prefab root control is this UIControl
|
||||
var loadingPreview = Viewport.Previews.PrefabPreview.LoadingPreview;
|
||||
var activePreviews = Viewport.Previews.PrefabPreview.ActivePreviews;
|
||||
if (activePreviews != null)
|
||||
{
|
||||
foreach (var preview in activePreviews)
|
||||
{
|
||||
if (preview == loadingPreview ||
|
||||
(preview.Instance != null && (preview.Instance == control || preview.Instance.HasActorInHierarchy(control))))
|
||||
{
|
||||
// Link it to the prefab preview to see it in the editor
|
||||
preview.customControlLinked = control;
|
||||
return preview;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void RegisterModule(EditorModule module)
|
||||
{
|
||||
Log("Register Editor module " + module);
|
||||
|
||||
Reference in New Issue
Block a user