Dev talk:Source/Blender/Modeling/Sculpting Tools

提供: wiki
2018年6月29日 (金) 02:47時点におけるYamyam (トーク | 投稿記録)による版 (1版 をインポートしました)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Blender does have a vector structure, defined in source/blender/makesdna/DNA_vec_types.h. There's also (two) libraries for dealing with vectors and matrices; these however only operate on arrays of three floats (see source/blender/blenlib/MTC_vectorops.h, MTC_matrixops.h for the newer library, and source/blender/blenlib/arithb.h for the older (and preferred) one).

-- Joeedh

Transform tools?

Would it be possible at all to connect this up as an input for Blender's existing transform system? It would be so good if you could 'paint' whatever transformation you like, such as move, rotate, shear, 'to sphere', etc.

--Broken 08:28, 2 June 2006 (CEST)

This is an interesting idea... some of it could be done by creating a "morph brush", which would morph areas of the mesh into another mesh. That would be an easy way to paint 'shear' and 'to sphere'. Rotate would be more difficult though, since it would be most useful if it were rotating locally around the cursor, not the entire model. --Nicholasbishop 18:42, 7 June 2006 (CEST)

Finding Adjacent Verts

Finding adjacent verts can be done by generating a look-up table of adjacency info on first entering sculpt mode. The basic idea that I've found to be fairly fast is to allocate an array of ListBases, each cell corrusponding to one vert, thus creating basically an array of doubly-linked lists. Then, you can simply loop through each edge in the mesh and add it (through a reference structure, since adding the edges directly will mess up the EditMesh structure) to the link-lists corrusponding to its first and second verts. At that point finding the adjacent edges around a vert is as simple as doing:

edgeref = array_of_listbases[vert->tmp.l] //you can store the vert-index in the array in 
                                          //the ->tmp.l member
while (edgeref) {
   edge = edgeref->edge;
   edgeref=edgeref->next;
}

I hope that makes sense (I'm really tired right now :) ).

-- Joeedh 3:23 PM (GMT -7 Arizona Mountain Time)

Thanks. This looks simpler and faster than how I'd been doing it, since this uses edges instead of faces. I'll incorporate this into the design. --Nicholasbishop 17:08, 7 June 2006 (CEST)