Graphics.EDGESimple3dOverlay - lordmundi/wikidoctest GitHub Wiki
EDGE Simple3d Overlay
« Adding a simple overlay | EDGE User’s Guide | EDGE Canvas Plugin Reference »
The article EDGESimpleOverlay talked about a minimal tcl script to create an overlay on the screen. But one often overlooked feature of the canvas plugin, is its ability to place a canvas not on a display or a viewport, but on a node itself.
Simple directions
-
Add the following code into a tcl script and source it in your "$USERDATA/user.cfg" (See Adding a Tcl Script if you need help doing this), or, just paste the following commands into your tcl command console. Note that the only difference between this script and the one in the EDGESimpleOverlay article is the commented out lines to create the canvas in a specific layer, and the "place" command which now places the canvas on the APAS_PMA2 node. We also added a circle to better see the placement of the canvas in the 3d scene.
doug.load_plugin dsp_canvas doug.load_plugin dsp_drawcanvas
#dsp_canvas create .example -background NONE -foreground #00ff00 -font arial -nrows 40 -ncols 60 dsp_canvas create .example -background NONE -foreground #00ff00 -font arial -nrows 62 -ncols 62 -layer foreground set myvariable 0.0 .example create text 1 1 -anchor w -textscale 1.0 1.0 -text "Some text to display!" -foreground #ffff00 -tag "text1 text2" .example create text 1 3 -anchor w -textscale 1.0 1.0 -text "Some more text in green" -foreground green -tag text3 .example create circle 31 31 30 -foreground green -tag TARGET_CIRCLE -fill "#006600" -opacity 0.3 -outline green -linewidth 1 .example create text 1 5 -anchor w -textscale 1.0 1.0 -textvariable myvariable -foreground pink -background black doug.callback add update -nodes "CM_Cam" { set myvariable [format "%.2f" [doug.node CM_Cam get -x]] }
#set mapping "[dsp.view MAIN get -mapping].MAIN" #dsp_canvas place .example -in_display ${mapping} dsp_canvas place .example -in_node APAS_PMA2 -width 3000 -height 3000 -anchor c
-
Run "./run_graphics" to see the overlay example
A simple 3d overlay in EDGE with a dynamic field and a translucent circle.
What's really going on
This code is virtually identical to the code in the EDGESimpleOverlay article, so please see that article for details of the code. The only differences in the above example are the lines that are commented out and the addition of a circle on the canvas.
« Adding a simple overlay | EDGE User’s Guide | EDGE Canvas Plugin Reference »