Issues.00106 - lordmundi/wikidoctest GitHub Wiki

00106: implement auto scale for 3d canvases in canvas plugin

« 00105 | Issues | 00107 »

Summary: implement auto scale for 3d canvases in canvas plugin

Created: 2008–09–09 16:41

Status: Released

Category: Request

From: frankie

Version: 2.0

Released_In: 2.1

Description:

it would be nice to have a feature to maintain a canvas size in proportion to the view frustum.


Comments

I have implemented the auto-scale feature and also added the ability to explicitly define which views you want a canvas to or not-to be displayed on. The auto-scale feature is enabled with a "-lock_size <view_port_relative_scale>" option when performing a place operation on a node in the scene (just like when you do a "-lock " to lock the "c" columns, "r" rows, or "b" both to the display screen. So for instance with the following:

doug.plugin dsp_canvas create TEST -nrows 20 -ncols 40 -background none -foreground #00ff00 -font arial
     doug.plugin dsp_canvas place TEST -in_node lpalm_A -z 10.0 -col_vec "0 1 0" -row_vec "1 0 0" -width 5.0 -height 3.0 -lock b -lock_size 0.2

     TEST create rectangle 0 0 39 19 -color #ffffff -outline #000000 -linewidth 3
     TEST create text 1 1 -text "Hellow World!" -foreground #000000 -anchor nw

you get a canvas that follows the node "lpalm_A" around on the screen but the canvas stays aligned with the viewport and is 20% the size of the viewport. So really in this case the "-lock_size 0.2" overrides the "-width 5.0" and "-height 3.0" commands since we have to have some way of telling the canvas what size to try and maintain that is viewport relative. You can also use the "-scale " command to keep the canvas a fixed sized when the viewport is resized, in which the "-lock_size " is a scale based on the viewport as it was originally defined. So for example if I add "-scale y" to the place command, then only the "Y" axis will scale with the viewport resize. By default "-scale both" is the setting. See the following:

doug.plugin dsp_canvas place TEST -in_node lpalm_A -z 10.0 -col_vec "0 1 0" -row_vec "1 0 0" -width 5.0 -height 3.0 -lock b -lock_size 0.2 -scale y

Now to use the viewport specific enable/disable display of a canvas attached to a node you can use the "<canvas_name> delview … " command like the following:

TEST delview MAIN

This would mean that all views will see the canvas except the one named "MAIN". To add a view back simply use the "<canvas_name> addview … " command like the following:

TEST addview MAIN

By default all viewports are enabled to keep compatibility with previous uses of the canvas.

brad

frankie April 17, 2009, at 02:01 PM: The git commit for this I believe does not have a very good commit message. For reference, the commit that fixes this issue is "0ffb2b6606b9c647825a5264f76029e5e925e89a".

frankie September 29, 2010, at 10:24 AM: WARNING! The addview and delview commands have a bug in EDGE v2.1. Don't use them. See this issue for details: Issues.00277


« 00105 | Issues | 00107 »

Associated Commits

⚠️ **GitHub.com Fallback** ⚠️