[Bf-committers] Layer system

Bob Holcomb bholcomb at mak.com
Fri Dec 21 14:09:26 CET 2007


This never made it on the ML from before since I used my work account 
(naughty me).

I just don't want it be a premature optimization (or feature in this 
case).  I've seen a lot of talk about expanding the layers, and 
comparison to Maya/Lightwave, but I haven't seen empirical evidence to 
support that 20 layers is not enough.  Is it truly a problem?  How many 
layers is reasonable?  What do the Peach guys think-they're probably 
pushing blender harder than the average user.  I personally would 
probably lose stuff given 999 layers to choose from.

Edit:  After talking to Cambo on irc, he says that people routinely need 
more than 20 layers, plus some other considerations.

That being said, bit fields are great, but they come at a cost.  If we 
want named layers and more than 32 of them, why don't we create an array 
(or linked list) of layer structs that has a list of the objects in the 
layer.  The layer struct itself can have data (like a name, visible) and 
then can point to all of its objects.  This way the object doesn't need 
to worry about what layer it is on, the layer struct does that. 

The code:

if (objectmask & viewmask) {
    draw_object();
}

becomes:

for (x = 0; x < numLayers; x++){
  if(objectlayer[x]->active){
    draw_objects_in_layer();
  }
}

Also, I would be seriously surprised if looping over an array of 1000 
layers  every redraw event  has an impact on the user experience (not 
frame rate).  I have yet to be able to find anybody who can tell the 
difference between 60 fps and 6000 fps.  I recommend  1) determining if 
there is a problem (edit: yes there is) 2)coming up with a good 
(flexible, easy to maintain) solution that works and then 3) optimize 
only if is identified as a bottleneck.

Just my 2 cents.

Cheers,

Bob



More information about the Bf-committers mailing list