bugpyFormex - Bugs: bug #40632, gl2 engine uses default draw...

 
 

bug #40632: gl2 engine uses default draw options instead of object attributes

Submitter:  Sofie Van Cauter <svcauter>
Submitted:  Tue 19 Nov 2013 11:49:18 AM UTC
   
 
Category:  Rendering Severity:  3 - Normal
Item Group:  Feature request Status:  Fixed
Privacy:  Public Assigned to:  bverheg
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 30 Jan 2014 01:43:39 PM UTC, comment #4: 

This issue is fixed, as shown by the following script:


resetAll()
clear()
F = Formex('1').setProp(1) # set prop 1 (red)
G = F.trl(1,-0.5)          # inherits prop 1 (red)
G.attrib(color=green)      # set attrib green
H = G.trl(1,-0.5)          # inherits prop 1 (red)
H.attrib(color=green)      # set attrib green
draw(F)             # F:red
draw(G)             # G:green
draw(H,color=blue)  # H:blue
zoomAll()


F has prop 1 and is drawn red
G has prop 1 and attrib green, so is drawn green
H has prop 1 and attrib green, but is drawn blue by argument

Benedict Verhegghe <bverheg>
Group administrator
Wed 20 Nov 2013 01:16:15 PM UTC, comment #3: 

The attributes to be used for the gl2 GeomActor were modified in 22e5150.

TODO: remove some arguments from the draw() kargs (e.g. view,bbox) before passing kargs to the actor.

Sofie Van Cauter <svcauter>
Group Member
Tue 19 Nov 2013 02:31:48 PM UTC, comment #2: 

This seems to be correct. Some of the attributes are however also used in the draw() function (e.g. clear_, view, bbox,highlight).

Sofie Van Cauter <svcauter>
Group Member
Tue 19 Nov 2013 02:11:18 PM UTC, comment #1: 

That seems indeed the logical way to do.
So pf.canvas.drawoptions should be removed from the draw() functions (i.e. just passing kargs to the Actor's _init_,
and there an Attributes should be created with the pf.canvas.drawoptions as default?


Benedict Verhegghe <bverheg>
Group administrator
Tue 19 Nov 2013 11:49:18 AM UTC, original submission:  

With the gl2 engine, the following code will draw the object in black instead of red:

F.attrib(color=red)
draw(F)


The draw function passes the default canvas draw options to the actor:

def draw(F,**kargs)
  attr = Attributes(pf.canvas.drawoptions)
  attr.update(kargs)
  actor = F.actor(**attr)


and consequently the object attributes are overwritten by the default draw options in the GeomActor creation:

def __init__(self,obj,**kargs):
  Attributes.__init__(self)
  self.update(obj.attrib)
  self.update(kargs)


However, it seems more logical to me to
- use the draw option if specified: e.g. draw(F,color=...)
- otherwise, use the object attribute if specified: e.g. F.attrib(color=...)
- otherwise, use the default draw option: i.e. color = 'prop'

Is this indeed the preferred order and what is the best way to implement this?

Sofie Van Cauter <svcauter>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by svcauter (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-30 bverheg Open/ClosedOpen Closed
    2014-01-30 bverheg StatusIn Progress Fixed
    2013-11-20 svcauter StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code