Skip to content

Commit

Permalink
Ignore m_SerializedDataModeController in Toolbox wizards; minor refac…
Browse files Browse the repository at this point in the history
…tor changes
  • Loading branch information
arimger committed Apr 2, 2024
1 parent 77a5642 commit 2e2611b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,37 +88,36 @@ internal static void Initialize()

private void DrawSettingsPanel()
{
EditorGUILayout.LabelField("Settings", EditorStyles.boldLabel);

var rect = EditorGUILayout.GetControlRect(true);
rect = EditorGUI.PrefixLabel(rect, Style.typeContent);
typeField.OnGui(rect, true, OnTypeSelected, data.InstanceType);
if (data.InstanceType == null)
{
return;
}

ToolboxEditorGui.DrawLine();

EditorGUI.BeginChangeCheck();
data.InstanceName = EditorGUILayout.TextField(Style.nameContent, data.InstanceName);
data.InstancesCount = EditorGUILayout.IntField(Style.countContent, data.InstancesCount);

EditorGUI.BeginChangeCheck();
var assignedInstance = EditorGUILayout.ObjectField(Style.objectContent, data.BlueprintObject, data.InstanceType, false);
data.BlueprintObject = assignedInstance;
if (EditorGUI.EndChangeCheck())
using (new EditorGUILayout.HorizontalScope())
{
UpdateBlueprintObjectEditor();
}
EditorGUI.BeginChangeCheck();
var assignedInstance = EditorGUILayout.ObjectField(Style.objectContent, data.BlueprintObject, data.InstanceType, false);
data.BlueprintObject = assignedInstance;
if (EditorGUI.EndChangeCheck())
{
UpdateBlueprintObjectEditor();
}

if (assignedInstance != null)
{
inspectDefaultObject = GUILayout.Toggle(inspectDefaultObject,
Style.foldoutContent, Style.foldoutStyle, Style.foldoutOptions);
}
else
{
inspectDefaultObject = false;
if (assignedInstance != null)
{
inspectDefaultObject = GUILayout.Toggle(inspectDefaultObject,
Style.foldoutContent, Style.foldoutStyle, Style.foldoutOptions);
}
else
{
inspectDefaultObject = false;
}
}

if (inspectDefaultObject)
Expand All @@ -129,7 +128,6 @@ private void DrawSettingsPanel()
}
}


if (EditorGUI.EndChangeCheck())
{
OnWizardUpdate();
Expand Down Expand Up @@ -237,7 +235,7 @@ protected override void OnWizardUpdate()
protected override void OnWizardGui()
{
base.OnWizardGui();
using (new EditorGUILayout.VerticalScope(Style.backgroundStyle))
using (new EditorGUILayout.VerticalScope())
{
DrawSettingsPanel();
}
Expand All @@ -250,6 +248,7 @@ private static class Style
internal static readonly GUIStyle backgroundStyle;
internal static readonly GUIStyle foldoutStyle;

internal static readonly GUIContent typeContent = new GUIContent("Instance Type");
internal static readonly GUIContent nameContent = new GUIContent("Instance Name");
internal static readonly GUIContent countContent = new GUIContent("Instances Count", "Indicates how many instances will be created.");
internal static readonly GUIContent objectContent = new GUIContent("Blueprint Object", "Will be used as a blueprint for all created ScriptableObjects.");
Expand Down
11 changes: 10 additions & 1 deletion Assets/Editor Toolbox/Editor/Wizards/ToolboxWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ namespace Toolbox.Editor.Wizards

public class ToolboxWizard : EditorWindow
{
private static readonly string[] propertiesToIgnore = new string[]
{
PropertyUtility.Defaults.scriptPropertyName,
"m_SerializedDataModeController"
};

private Editor targetEditor;

private Vector2 scrollPosition;
Expand Down Expand Up @@ -84,7 +90,10 @@ private void ReinitEditor(Editor editor)
editor.hideFlags = HideFlags.HideAndDontSave;
if (editor is ToolboxEditor toolboxEditor)
{
toolboxEditor.IgnoreProperty(PropertyUtility.Defaults.scriptPropertyName);
foreach (var property in propertiesToIgnore)
{
toolboxEditor.IgnoreProperty(property);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public TitleAttribute(string label)
Label = label;
}


public override ToolboxAttribute[] Process()
{
return new ToolboxAttribute[]
Expand All @@ -42,7 +41,6 @@ public override ToolboxAttribute[] Process()
};
}


public string Label { get; private set; }

/// <summary>
Expand Down
Binary file modified Docs/createso.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2e2611b

Please sign in to comment.