[Bf-committers] KnifeSubdivide and turning corners...

Robert Wenzlaff bf-committers@blender.org
Tue, 9 Sep 2003 09:37:50 -0400


I've been made a knife "subdivide tool", where you draw a mouse trail on the 
screen and the edges are subdivided IFF the verts are selected ans it is 
intersected by the mouse trail.  Very useful for adding extra geometry to a 
model.  It's working except for 1 minor flaw, and one anoying behavior 
(blender's fault not mine!)

The flaw is, I need to disable gestures while the trail is drawn.   My first 
thought was to make a G.flag value that bypassed calls to gesture().  It 
dosn't seem to quite work, maybe I missed one...  I'll look more later, but 
any hints are appreciated.

The anoyance is that when turning corners, it creates 4 tris.  If the new 
diagonal between the subdivided edges were also subdivided (like both new 
edges in a quad divided in 4), this could be filled with 3 quads instead.   I 
was looking at the code in subdivideflag() and had it working for 1 of the 4 
cases (edges 1 and 4 have new verts)  but I wasn't sure if my method was 
safe.  Can I rely on the edges being in sequential order, so that edge1 is 
always next to edge2?  Or do I need a new method before moving on to the 
other 3 cases?

Then, of course,  I need to get the uv mapping right.

Patch for my knife subdivide tool (against Tuhopuu2) is here:
http://www.soylent-green.com/KnifeSubT2_rev2.patch  if you want to try it out.
Rev1 fails because of int math roundoff error.  Had to do the math in floats.
(Usage: Select verts, hit K, LMB drag line, hit K).
-- 
***********************************************
  "Obscure, Profound it was, and Nebulous, 
  So that by fixing on it's depths my sight, 
  Nothing whatsoever I discerned therein."

    		    -Dante, predicting the 
		        Windows 95 API.
***********************************************
Robert Wenzlaff     rwenzlaff@soylent-green.com