Canvas troubleshooting: Difference between revisions

Jump to navigation Jump to search
m
Line 198: Line 198:


=== Dumping Canvas scene graphs to disk ===
=== Dumping Canvas scene graphs to disk ===
Here's the required SimGear changes to add a new method for dumping the scene graph for each Canvas to a file:
<syntaxhighlight lang="diff">
<syntaxhighlight lang="diff">
</syntaxhighlight>
Here's the FlightGear part for the SimGear changes above exposing the new API via <code>canvas.dumpSceneGraph()</code>:
<syntaxhighlight lang="diff">
diff --git a/src/Scripting/NasalCanvas.cxx b/src/Scripting/NasalCanvas.cxx
index 4fa7652..2b63f02 100644
--- a/src/Scripting/NasalCanvas.cxx
+++ b/src/Scripting/NasalCanvas.cxx
@@ -478,7 +478,8 @@ naRef initNasalCanvas(naRef globals, naContext c)
    .method("dispatchEvent", &sc::Canvas::dispatchEvent)
    .method("setLayout", &sc::Canvas::setLayout)
    .method("setFocusElement", &sc::Canvas::setFocusElement)
-    .method("clearFocusElement", &sc::Canvas::clearFocusElement);
+    .method("clearFocusElement", &sc::Canvas::clearFocusElement)
+    .method("dumpSceneGraph", &sc::Canvas::dumpSceneGraph);
  canvas_module.set("_newCanvasGhost", f_createCanvas);
  canvas_module.set("_getCanvasGhost", f_getCanvas);
</syntaxhighlight>
</syntaxhighlight>


Navigation menu