Merge branch 'prefab-buttons' of https://github.com/Tryibion/FlaxEngine into Tryibion-prefab-buttons

This commit is contained in:
Wojtek Figat
2024-07-02 09:11:38 +02:00

View File

@@ -67,32 +67,35 @@ namespace FlaxEditor.CustomEditors.Dedicated
// Use default prefab instance as a reference for the editor // Use default prefab instance as a reference for the editor
Values.SetReferenceValue(prefabInstance); Values.SetReferenceValue(prefabInstance);
// Add some UI if (Presenter == Editor.Instance.Windows.PropertiesWin.Presenter)
var panel = layout.CustomContainer<UniformGridPanel>();
panel.CustomControl.Height = 20.0f;
panel.CustomControl.SlotsVertically = 1;
panel.CustomControl.SlotsHorizontally = 3;
// Selecting actor prefab asset
var selectPrefab = panel.Button("Select Prefab");
selectPrefab.Button.Clicked += () =>
{ {
Editor.Instance.Windows.ContentWin.ClearItemsSearch(); // Add some UI
Editor.Instance.Windows.ContentWin.Select(prefab); var panel = layout.CustomContainer<UniformGridPanel>();
}; panel.CustomControl.Height = 20.0f;
panel.CustomControl.SlotsVertically = 1;
panel.CustomControl.SlotsHorizontally = 3;
// Selecting actor prefab asset
var selectPrefab = panel.Button("Select Prefab");
selectPrefab.Button.Clicked += () =>
{
Editor.Instance.Windows.ContentWin.ClearItemsSearch();
Editor.Instance.Windows.ContentWin.Select(prefab);
};
// Edit selected prefab asset // Edit selected prefab asset
var editPrefab = panel.Button("Edit Prefab"); var editPrefab = panel.Button("Edit Prefab");
editPrefab.Button.Clicked += () => editPrefab.Button.Clicked += () =>
{ {
Editor.Instance.Windows.ContentWin.ClearItemsSearch(); Editor.Instance.Windows.ContentWin.ClearItemsSearch();
Editor.Instance.Windows.ContentWin.Select(prefab); Editor.Instance.Windows.ContentWin.Select(prefab);
Editor.Instance.Windows.ContentWin.Open(Editor.Instance.Windows.ContentWin.View.Selection[0]); Editor.Instance.Windows.ContentWin.Open(Editor.Instance.Windows.ContentWin.View.Selection[0]);
}; };
// Viewing changes applied to this actor // Viewing changes applied to this actor
var viewChanges = panel.Button("View Changes"); var viewChanges = panel.Button("View Changes");
viewChanges.Button.Clicked += () => ViewChanges(viewChanges.Button, new Float2(0.0f, 20.0f)); viewChanges.Button.Clicked += () => ViewChanges(viewChanges.Button, new Float2(0.0f, 20.0f));
}
// Link event to update editor on prefab apply // Link event to update editor on prefab apply
_linkedPrefabId = prefab.ID; _linkedPrefabId = prefab.ID;