feat: more plugin work and intra-scope communication

This commit is contained in:
redglow
2026-07-18 10:56:54 +02:00
parent 7c16dddbd0
commit ce58a3a2c2
22 changed files with 246 additions and 56 deletions
+5 -2
View File
@@ -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();
}