feat: more plugin work and intra-scope communication
This commit is contained in:
@@ -77,6 +77,7 @@ public partial class Plugin : EditorPlugin
|
||||
// mark debounce as completed
|
||||
_sceneTreeTimer = null;
|
||||
|
||||
|
||||
// check that the instance is still valid after debouncing (could have been disposed)
|
||||
if (!IsInstanceValid(sceneRoot)) return;
|
||||
|
||||
@@ -96,6 +97,7 @@ public partial class Plugin : EditorPlugin
|
||||
return;
|
||||
default:
|
||||
{
|
||||
if (!IsInstanceValid(serviceSource)) return;
|
||||
// find all nodes that need injection
|
||||
var nodesNeedingInjection = sceneNodes.Where(node =>
|
||||
{
|
||||
@@ -109,7 +111,7 @@ public partial class Plugin : EditorPlugin
|
||||
}).ToList();
|
||||
|
||||
// add all nodes needed to the scope
|
||||
var injectedNodes = serviceSource!.Get(ServiceSource.PropertyName.InjectedNodes).AsGodotArray();
|
||||
var injectedNodes = serviceSource.Get(ServiceSource.PropertyName.InjectedNodes).AsGodotArray();
|
||||
Array? newArray = null;
|
||||
foreach (var node in nodesNeedingInjection
|
||||
.Where(node => !injectedNodes.Contains(node)))
|
||||
@@ -137,7 +139,8 @@ public partial class Plugin : EditorPlugin
|
||||
var undoRedo = GetUndoRedo();
|
||||
undoRedo.CreateAction("Update injected nodes");
|
||||
undoRedo.AddDoProperty(serviceSource, ServiceSource.PropertyName.InjectedNodes, newArray);
|
||||
undoRedo.AddUndoProperty(serviceSource, ServiceSource.PropertyName.InjectedNodes, injectedNodes);
|
||||
undoRedo.AddUndoProperty(serviceSource, ServiceSource.PropertyName.InjectedNodes,
|
||||
new Array(injectedNodes));
|
||||
undoRedo.CommitAction();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user