Skip to content

Commit

Permalink
Merge pull request #51 from techno-dwarf-works/feature/refactoring
Browse files Browse the repository at this point in the history
Version 0.0.48
  • Loading branch information
uurha authored Sep 1, 2024
2 parents b1ee425 + 31f0fec commit a6e80c8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
36 changes: 21 additions & 15 deletions Assets/BetterCommons/Editor/CustomEditors/MultiEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,35 +99,41 @@ protected void SetOverrideDefault(bool value)

public override VisualElement CreateInspectorGUI()
{
var m = Editor.CreateInstance<MultiEditor>();
m.SetOverrideDefault(false);
var container = new VisualElement();

for (var i = 0; i < _preEditors.Count; i++)
{
var element = _preEditors[i].CreateInspectorGUI();
if (element != null)
{
container.Add(element);
}
}
IteratePreEditors(container);

if (!_overrideDefault)
{
InspectorElement.FillDefaultInspector(container, serializedObject, this);
}

for (var i = 0; i < _postEditors.Count; i++)
IteratePostEditors(container);

container.TrackSerializedObjectValue(serializedObject, OnSerializedObjectTrack);
return container;
}

protected void IteratePreEditors(VisualElement container)
{
IterateEditors(_preEditors, container);
}

protected void IteratePostEditors(VisualElement container)
{
IterateEditors(_postEditors, container);
}

private void IterateEditors(List<ExtendedEditor> extendedEditors, VisualElement container)
{
for (var i = 0; i < extendedEditors.Count; i++)
{
var element = _postEditors[i].CreateInspectorGUI();
var element = extendedEditors[i].CreateInspectorGUI();
if (element != null)
{
container.Add(element);
}
}

container.TrackSerializedObjectValue(serializedObject, OnSerializedObjectTrack);
return container;
}

protected virtual void OnSerializedObjectTrack(SerializedObject serializedObject)
Expand Down
2 changes: 1 addition & 1 deletion Assets/BetterCommons/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.tdw.better.commons",
"displayName": "Better Commons",
"version": "0.0.47",
"version": "0.0.48",
"unity": "2021.3",
"description": " ",
"dependencies": {
Expand Down

0 comments on commit a6e80c8

Please sign in to comment.