Placing an `ObjectEditor` inside an `IObjectEditor`

Hey all, this is both a bug and a question.

In some cases, I’d like to “augment” the default object editor that comes with the ObjectEditor node. Could be that I want to add an extra widget on top of the ones that come “out of the box”. I naively created an IObjectEditor, threw my custom stuff in there and then added an ObjectEditor after, like in this repro screenshot (not my actual project) :

Though, it looks like adding an ObjectEditor node inside an IObjectEditor is problematic. When doing that, I get the following error :

Full Error
2024/09/16 12:19:32.803 [CRT] (App) 0 HowTo Build A Custom Editor Unexpected exception during Update: OUTDATED: o: 0(-1) p: 3(-2) PersonEditor
REASON: Outdated, RestoreState

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> VL.Core.RuntimeCommandException: OUTDATED: o: 0(-1) p: 3(-2) PersonEditor
REASON: Outdated, RestoreState
   at VL.Core.RuntimeCommandException.Complain(String exceptionMessage, RuntimeCommand runtimeCommand)
   at VL.Lang.Platforms.SwapHelpers.React(NodeContext nodeContext, SwapTroubleReaction troubleReaction, String innerMessage, String outerMessage, String exceptionMessage)
   at VL.Lang.Platforms.SwapHelpers.OnReport(NodeContext nodeContext, String what, HotswapTrouble hotswapTrouble)
   at VL.AppServices.CompilationHelper.Report(NodeContext context, String what, HotswapTrouble hotswapTrouble)
   at VL.AppServices.Hotswap.SwappableVLObject`1.__Restore[TStateClass]()
   at _HowTo_Build_A_Custom_Editor_.Main.PersonEditor_CProgram_.Draw_(PersonEditor_C __self, Context Context_In) in C:\Program Files\vvvv\vvvv_gamma_6.7-0145-g7866bdf1e8\packs\VL.ImGui\help\Editors\HowTo Build A Custom Editor.vl.1.cs:line 372
   at _HowTo_Build_A_Custom_Editor_.Main.PersonEditor_C.VL.ImGui.Editors.IObjectEditor.Draw(Context context) in C:\Program Files\vvvv\vvvv_gamma_6.7-0145-g7866bdf1e8\packs\VL.ImGui\help\Editors\HowTo Build A Custom Editor.vl.1.cs:line 303
   at VL.ImGui.Editors.ListEditorBase`2.Draw(Context context)
   at _VL_ImGui_.ImGui.Editors.ObjectEditor_Sl6sCYFwyqFQcYSm1ujZFy.Update(Context Context_In, IChannel Channel_In, String Label_In, IStyle Style_In, Boolean View_Only_In, IObjectEditorFactory Factory_In, Boolean Primitive_Only_In, Context& Context_Out, Boolean& Has_Editor_Out)
   at _HowTo_Build_A_Custom_Editor_.__auto.HowTo_Build_A_Custom_EditorApplication_K1ReS4HoxT4ODpkCKClgX0Program_.<>c__DisplayClass4_0.<Update__TRACE__>b__0(Object stateInput_26, IReadOnlyList`1 inputs_28, IReadOnlyList`1 incomingLinks_29, Object& stateOutput_31, Spread`1& outputs_32) in C:\Program Files\vvvv\vvvv_gamma_6.7-0145-g7866bdf1e8\packs\VL.ImGui\help\Editors\HowTo Build A Custom Editor.vl.1.cs:line 240
   at _VL_ImGui_.ReGui.ImmediateModeNode_C.<>c__DisplayClass3_0.<Update>b__0(Context Obj_In_51)
   at VL.ImGui.Widget.Update(Context context)
   at VL.ImGui.ToSkiaLayer.Update(Widget widget, Boolean dockingEnabled, Spread`1 fonts, IStyle Style)
   at _VL_ImGui_Skia_.Graphics.Skia.Layer.ImGui_Pb0jmhYedzLP452JM5MUGn.Update(ICustomRegion Region_In, Boolean Docking_Enabled_In, Spread`1 Fonts_In, Boolean Add_Fullscreen_Window_In, IStyle Style_In, Boolean Use_Skia_Space_In, ILayer& Output_Out)
   at _HowTo_Build_A_Custom_Editor_.__auto.HowTo_Build_A_Custom_EditorApplication_K1ReS4HoxT4ODpkCKClgX0Program_.Update__TRACE__(HowTo_Build_A_Custom_EditorApplication_K1ReS4HoxT4ODpkCKClgX0 __self, PatchTracer __tracer) in C:\Program Files\vvvv\vvvv_gamma_6.7-0145-g7866bdf1e8\packs\VL.ImGui\help\Editors\HowTo Build A Custom Editor.vl.1.cs:line 258
   at _HowTo_Build_A_Custom_Editor_.__auto.HowTo_Build_A_Custom_EditorApplication_K1ReS4HoxT4ODpkCKClgX0Program_.Update(HowTo_Build_A_Custom_EditorApplication_K1ReS4HoxT4ODpkCKClgX0 __self) in C:\Program Files\vvvv\vvvv_gamma_6.7-0145-g7866bdf1e8\packs\VL.ImGui\help\Editors\HowTo Build A Custom Editor.vl.1.cs:line 47
   at InvokeStub_HowTo_Build_A_Custom_EditorApplication_K1ReS4HoxT4ODpkCKClgX0.Update(Object, Object, IntPtr*)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
   at VL.Lang.Platforms.RuntimeInstance.Step(ITargetCompilation compilation, TimeSpan timeSinceStart)
   at VL.Lang.Platforms.RuntimeHost.StepInstances(ITargetCompilation compilation, TimeSpan timeSinceStart, Boolean& hadToKill)

I guess it’s creating some kind of crazy recursion thing, but can’t be sure :-)

Repro :

  • Open the Build a Custom Editor help patch
  • Open the PersonEditor class definition
  • Add an ObjectEditor as shown above and press F9

How should I do such a thing? Workaround is to explicitly patch all widgets like doing for the “extra” stuff. What do you think?

Thankssss

Should be fixed in latest previews. Thank you for the detailed report!

1 Like