1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 01:06:01 +08:00

Fixed an issue with Undo / Redo not working correctly with Odin PropertyTree

This commit is contained in:
Kailey Joanette 2020-12-15 19:13:44 -05:00 committed by Thor Brigsted
parent d4deeed45b
commit 75a04920b1
2 changed files with 32 additions and 4 deletions

View File

@ -39,10 +39,28 @@ namespace XNodeEditor {
string[] excludes = { "m_Script", "graph", "position", "ports" };
#if ODIN_INSPECTOR
InspectorUtilities.BeginDrawPropertyTree(objectTree, true);
GUIHelper.PushLabelWidth(84);
objectTree.Draw(true);
try
{
#if ODIN_INSPECTOR_3
objectTree.BeginDraw( true );
#else
InspectorUtilities.BeginDrawPropertyTree(objectTree, true);
#endif
}
catch ( ArgumentNullException )
{
objectTree.EndDraw();
NodeEditor.DestroyEditor(this.target);
return;
}
GUIHelper.PushLabelWidth( 84 );
objectTree.Draw( true );
#if ODIN_INSPECTOR_3
objectTree.EndDraw();
#else
InspectorUtilities.EndDrawPropertyTree(objectTree);
#endif
GUIHelper.PopLabelWidth();
#else

View File

@ -24,7 +24,7 @@ namespace XNodeEditor.Internal {
private PropertyTree _objectTree;
public PropertyTree objectTree {
get {
if (this._objectTree == null) {
if (this._objectTree == null){
try {
bool wasInEditor = NodeEditor.inNodeEditor;
NodeEditor.inNodeEditor = true;
@ -58,6 +58,16 @@ namespace XNodeEditor.Internal {
return editor;
}
public static void DestroyEditor( K target )
{
if ( target == null ) return;
T editor;
if ( editors.TryGetValue( target, out editor ) )
{
editors.Remove( target );
}
}
private static Type GetEditorType(Type type) {
if (type == null) return null;
if (editorTypes == null) CacheCustomEditors();