Commit Graph

177 Commits

Author SHA1 Message Date
a720296999 Another 3-in-one commit:
- Unitialized variable in new shadow code caused Sun lamp shadow to not
  work.
- Ipo handle bug: when the handle was vertical it flipped around
- Loop select: unitialized variable caused it to work unpredictable in
  cases. Also found an unitialized var in collaps_edgeuvs().
2006-12-06 11:17:34 +00:00
e435fbc3c5 Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.

Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData


Replaced TFace by MTFace:

This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.


Removed DispListMesh:

This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.


Removed ssDM and meshDM DerivedMesh backends:

The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.


This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 04:28:02 +00:00
Ken Hughes
318a694a25 Get rid of various warnings with gcc under linux 2006-11-17 17:50:43 +00:00
c25c249eb0 Fixed bug #5235, "deleting edges, verts, or faces in multires does bizarre things to mesh"
Added a simple check to a number of editing operations. If multires is enabled,
an error is displayed and the operation is cancelled. This includes adding and
deleting verts/edges/faces, and anything that would reorder elements.
2006-11-15 22:24:05 +00:00
e4a1eb4e09 Added custom vertex data support to editmode. Only used for vertex groups
now, others can be added later (sticky, shape keys). Beside one small fix
for knife exact vertex group interpolation, is intended to work the same
as before.

Also fixes bug #5200, related to editmode undo and vertex groups. And
corrects the editmode to faceselect mode selection conversion, that was
broken in a previous commit.
2006-11-11 23:23:15 +00:00
97f892b86b Added custom face data support in edit mode. The code used to do this is
the CustomData module from the modifier stack rewrite, but with additions
to make it also usable in edit mode. Some of the datatypes from that
module were move to a DNA header file, they are not saved to file now, but
will be soon.

The only code that wasn't abstracted is the uv collapse / merging code. It
is rather complicated, will look into that in the future.

There should be no user level changes.
2006-11-11 16:38:37 +00:00
Ken Hughes
56a12a30c5 Patch #4896, submitted by Juho Vepsäläinen (bebraw):
Allows "Degr" field in Mesh tools accept negative and positive float values
from range [-360, 360].
2006-11-09 14:30:11 +00:00
011f531359 Modified the way booleans preserve face data, and cleaned up some
duplicate code. Also removed redundant files from the bsp module,
that where replaced by boolop last year, no sense in updating them
for these changes. On the user level things should still work the
same, this is only preparation work.

Not counting the removed files, -1501 lines of code, not too bad :)
2006-11-08 20:14:04 +00:00
c6976219fb ->Join triangles fixes.
There was a bug with the new join triangles code that caused concave faces to be
created. This is fixed now and is tweakable using the the 'threshold' value set
in the 'Mesh Tools' panel in editbuttons.

Also removed the popup notice telling you how many triangles had been joined. It
was only there for debugging purposes.
2006-11-08 05:18:11 +00:00
e259923340 -> Triangle to Quad bugfix
Last minute bugfixing for last commit introduced a brand new bug causing
Crashes, whoops! Fixed now.
2006-10-18 06:06:15 +00:00
134e562219 -> Improved Triangle to Quad conversion
Alt-J behavior has been replaced by a port of the Tri2Quad python script
currently in CVS. This method has many advantages over the old behavior.
A simple illustration of how the new method is superior to the old can be
made by triangulating a suzzane and converting it back to quads.

	http://www.umsl.edu/~gcbq44/t2q2a.jpg
	http://www.umsl.edu/~gcbq44/t2q2b.jpg

The algorithm works by considering all possible triangle pairings and then
weighting them according to how appropriate it would be to join. These pairs
are then quick-sorted and those with the highest weighting factor are combined.
The function is quite fast even for dense meshes and usually involves no
noticeable wait-time for completion. For instance the following imported
model took less than 2 seconds to convert on my 1.3ghz PPC powerbook:

	http://www.umsl.edu/~gcbq44/mimitri.jpg
	http://www.umsl.edu/~gcbq44/mimiquad.jpg

It should be noted by the user that this method also discards face pairs
where the two triangles:

-do not share the same material
-do not share the same UV image (texface)
-do not share a compatible set of UV coordinates
-do not share a compatible set of vertex colors
-will form a concave quad or create a non-planar face

Additionally if the edge shared by the pair is marked 'sharp' the pair
will be discarded from the quicksort. In this way the user can gain great
control over the conversion process if they desire as this imported VRML
model of a sneaker illustrates:

	http://www.umsl.edu/~gcbq44/t2qa.jpg
	http://www.umsl.edu/~gcbq44/t2qb.jpg

For the future it would be nice if some of the options for the conversion
process, such as angle tolerance, could be made configurable in the UI.
However it is unclear at this time which options should be made configurable
and where to put them. Feedback on this is appreciated.

Special Thanks goes to Joe Eager for the two macros he contributed to this code
and to Campbell Barton for writing the script this was based on!
2006-10-18 05:18:51 +00:00
e7874b3ff0 ->Knife Midpoint and Vertex Cutting
Cutting through vertices and vertex snap was only supported in
'knife exact' mode. Now works for 'Knife Midpoint' as well.
(Multicut and vertex cutting would require N-Gons)
2006-09-19 00:08:09 +00:00
d9ff064cf7 Menu to copy Shapes (Editmode Mesh, CTRL+C) now displays in columns 2006-09-12 10:39:22 +00:00
2ee42ac01e Huge commit: VERSE
- All code is in #ifdef ... #endif
 - Only make build system is supported and you have to add:
    export WITH_VERSE=true
   to user-def.mk file
 - Blender can share only mesh objects and bitmaps now
 - More informations can be found at wiki:
    http://mediawiki.blender.org/index.php/BlenderDev/VerseIntegrationToBlender
    http://mediawiki.blender.org/index.php/BlenderDev/VerseIntegrationToBlenderUserDoc

  I hope, that I didn't forget at anything
2006-08-20 15:22:56 +00:00
e96c813cc3 -> Vertex support for knife tool
Previously the knife tool only allowed you to cut through edges. This
approach is limited however, since many times you want to cut through
vertices in order to create precise cuts or terminate a cut in a specific
way. Blenders knife tool now supports cutting through vertices as
demonstrated in these pictures:

http://briggs.zanqdo.com/newknife1.jpg
http://briggs.zanqdo.com/newknife2.jpg

Since the vertex intersection code is very precise, vertex snapping has
been added to the knife tool to assist the user when they wish to cut
through vertices and can be toggled by pressing and holding the 'alt' key.

Notes:
-Vertex cutting and vertex snapping are only available when using the
'knife exact' option.
-Added various fixes to the precision of the knife tool.
2006-08-11 07:24:33 +00:00
c2edcd4879 Siggraph show commit!
- pending commit for OSX intel systems, with intel graphics. These now call
  an extra swapbuffers after glFlush(). Code is ifdeffed, and doesnt affect
  other systems.

- show-off commit: option to have transparent nodes over the composite
  result. Only draws Image for active Viewer Node now, and image doesnt
  translate nor zoom (which isnt bad though).
  Set in themes the alpha color of "node backdrop" to make nodes
  transparent.
2006-07-31 19:23:42 +00:00
54931c1192 Protests! So, we then better live with a switch to edge-select on using
the 'region to loop', and implement the notice using a non-blocking status
line once.

Nice proposal:
http://mke3.net/blender/interface/interaction/statusline_error.png
2006-07-05 13:34:03 +00:00
f8377553c8 Minor fix: the "Region to Loop" option changes selection mode to 'edge'
by default. Was already a report in tracker... I think it is nicer to
notify user of such changes first.
2006-07-05 12:18:02 +00:00
41b0a4a3ad Bug #4552
Added extra security for fill faces. This function is being used for
importing now too, and it gets called for quite weird fill cases...
nevertheless, it should not crash!
2006-07-01 10:02:26 +00:00
5b4fa8a93e Fix for bug #4523:
- Crash on collapse with subsurf modifier. Cause was a missing DAG update
  when calling from the 3d view header menu.

  There really should be some standard way to place these countall, DAG
  update, redraw and undo push calls for editmesh tools, now they're in
  random places in the editmesh and UI code.
2006-06-28 13:49:11 +00:00
ffff27c897 Changed error message for "Screw" tool in Edit Mesh into:
"You have to select a string of connected vertices too"

(Was: "You have to select a Curve").
2006-06-24 11:30:19 +00:00
7cb459b95d fix #4327
The Mesh Bevel tool doesn't look at selection (works on all) but it called
a recalc-normals that assumed selection. Added a select-all prior to bevel.

(bevel doesnt even respect hidden!)
2006-06-22 13:04:11 +00:00
75c6fe760f Bugfix #4411
New option "Loop to region" selection crashed when no valid loop was
selected. Just a NULL pointer check.
Also: unified function declaration syntax, so it matches with rest of code.
2006-06-22 10:34:01 +00:00
c276501a10 small change, the edge collapse limit was only 0.001, whats way too big and I found it removed more points then just the ones that collapsed.
changed to 0.000001 - the verts are collapsed to the same location so it they shuld not to offset from eachother anyway.
2006-06-21 15:36:05 +00:00
4a1d4653da -> Fix for bug #3867
Face loop cut was failing on meshes with hidden parts. Also modified edge
ring selection code in editmesh_mods.c to ignore hidden parts of mesh.
2006-06-08 05:41:57 +00:00
a9ac112be6 -> Fix for bug #4162
Bug in buttons_editing.c meant that edge subdivide code was getting called
with wrong arguments when accessed via the edit buttons, but was called
correctly from wkey menu.

Also added Alexander's small fix so that beauty subdivide behaves correctly
when used on non-proportionally scaled objects.
2006-05-31 01:49:05 +00:00
6387c85557 -> UV Edge collapse
Added code to make 'Collapse Edges' handle UV's intelligently. This seems to work in just about every case that I can test, so it's turned on by default.

Also completely removed the 'collapse faces' command and code. I'm not sure what I was thinking with this in the first place since edge collapse does the same job while in in face mode. Because of this there is now just one single command that covers both situations called 'Collapse' which uses the edge collapse code.
2006-05-29 05:17:38 +00:00
b0c5df16f6 Made editmesh remove_doubles work with vertex colours,
added vertex colour support to BPyMesh_redux polygon reducing function.
2006-05-13 12:36:48 +00:00
6e047236c3 -> Fix for Bug #4181
Silly typo in a call to memcpy was leading to crashes when doing remove doubles with vertex weights (whoops!) Fixed now.
2006-05-10 20:34:45 +00:00
7b1d69a35c -> Stored Selections
Previously Blender did not store the order in which vertices, edges
or faces were selected in edit mode. In many cases it is useful to
have this data, however it is not desirable to store every selection
made. Now blender stores selections in the order in which they were
made in a linked list called 'selected' in  EditMesh. EditSelection structs
are created whenever 'EM_store_selection' from  editmesh_lib.c is called
(currently only on user selection with mouse). There are several cases
in which they might be deallocated by calling the 'EM_remove_selection'
function however:

-When the user deselects something with the mouse ('mouse_mesh' in
 editmesh_mods.c)

-When switching selection modes stored selections that are not relevant
to the new mode are removed by the 'EM_strip_selections' function
(multi-select mode is supported)

-When the vertex, edge or face pointed to by a certain stored selection is
deallocated

-When EM_clear_flag_all is called and where the flag passed to the function
contains the 'SELECT' bitmask.

-When leaving edit mode (making stored selection data persistent across
editing sessions will require modifications to mesh DNA later)

Todo:

There are a few cases still where you can temporarily end up with a stored
selection that points to an element that is no longer selected
(edge loop de-select can cause this for instance). The solution to this is to
add a call to EM_remove_selection from 'EM_select_edge' and 'EM_select_face' when
these functions are being used to deselect elements. For the sake of completeness
however this will also require that an 'EM_select_vert' function be coded and
called at all appropriate parts of the editmesh code. I will look into this
later in the week.

For now there are two tools that already take advantage of the stored selections.
The first one is 'merge at first or last vertex' in the merge menu (the 'firstvert' and
'lastvert' pointers are gone from EditMesh). The second tool is path select, which builds
a path between the last vert selected and the second to last vert selected. This allows you
to build complex path selections in a short amount of time like this
'select A, select B, path select. select C, path select. select D...'
2006-03-27 05:19:14 +00:00
e4439dd050 2 New tools, 'Loop to region' and 'Region to loop'
-> Loop to Region
Examines the current set of selected edges and seperates them into groups
 of 'loops' that each bisect the mesh into two parts. Then for each loop it
selects the smaller 'half' of the mesh.

Example images:
http://www.umsl.edu/~gcbq44/looptoregion2a.jpg
http://www.umsl.edu/~gcbq44/looptoregion2b.jpg

This tool handles multiple loops fine as is shown by these images:
http://www.umsl.edu/~gcbq44/looptoregion1a.jpg
http://www.umsl.edu/~gcbq44/looptoregion1b.jpg

Furthermore it handles 'holes' just fine as well:
http://www.umsl.edu/~gcbq44/looptoregion3a.jpg
http://www.umsl.edu/~gcbq44/looptoregion3b.jpg

-> Region to Loop

This is the 'logical inverse' of loop to region.

Example:
http://www.umsl.edu/~gcbq44/regiontoloop1a.jpg
http://www.umsl.edu/~gcbq44/regiontoloop1b.jpg

Both features can be accessed by the 'Edge Menu' in EditMode (CTRL-E).
2006-03-15 20:53:41 +00:00
a6ed488b74 -> Path Select Tool
Rewrote path select tool to use binary heap implementation from BLI_heap.h. Incredible speedup! Thanks to Brecht for the tip.
2006-03-09 22:44:14 +00:00
d51a6020c8 -> Path Select Tool
Added a new tool to the 'W-Key' popup menu in mesh editmode, 'Path Select'.
When exactly two vertices are selected, 'Path Select' will find the shortest
path of vertices between them. There are two methods for determining
the shortest path, one that finds the path with shortest physical
distance, and one that finds the path with shortest topological distance.

Examples:

Original Selection
http://www.umsl.edu/~gcbq44/pathselect.jpg

Path Select - Edge Length
http://www.umsl.edu/~gcbq44/pathselect-shortestphysical.jpg

Path Select - Topological
http://www.umsl.edu/~gcbq44/pathselect-topological.jpg

The tool uses a straightforward implementation of Dijsktra's algorithm
and may be a bit slow on extremely large meshes. As a speedup you can
hide the parts of the mesh that you are not working on and they will
not be searched.
2006-03-08 03:28:17 +00:00
13a1a4c15e -> Vertex Group/Weight support in removedoublesflag()
Remove doubles didn't previously deal with vertex groups/weights properly. Now it averages the weights of vertices when they are doubles and share the same group. Verts that get merged but don't belong to all the same groups are dealt with as well.
2006-03-01 03:33:45 +00:00
30437b47ed Fixes small problem with my last commit and MSVC compilers, originally pointed
out on commiters ML here:
http://projects.blender.org/pipermail/bf-committers/2006-February/013677.html
2006-02-22 14:14:43 +00:00
dcb751725e [Two Sections here; First is the log that *should* have been included
to my previous commit (whoops). The second part covers the changes I
have made to the code since then (all related to merge tools code).]

# Part One: Complete Log for Commit from 2/13/06

-> Upgraded merge tools.

The new merge tools add several options to blenders Merge submenu,
accessed via the WKEY whilst in Editmode for meshes. The new options
depend on current mode:

- Vertex mode: "At First" and "At Last"

When choosing "At First" or "At last" it will merge all selected
vertices at the first or last selected vertex.

(Note: Blender now keeps track of the last and first verts selected in
editMode (G.editMesh->lastvert and G.editMesh->firstvert
pointers. This meant additions were made to the undomesh code in
editmesh.c as well).

- Edge mode: "Collapse Edges"

When choosing this option, Blender examines the current set of
selected edges and groups them according whether or not they are
topologically connected. It then goes through each group and merges
them one by one to a single point.

- Face Mode: "Collapse Faces"

Works the same as "Collapse Edges", only works on groups of
topologically connected faces.

-> Inclusive selection mode conversion.

This feature extends the ability of blenders selection mode
conversions. Currently when you change selection modes from a "lower
order" mode to a "higher order" one (vertex->edge, vertex->face or
edge->face) blender only selects elements in the new mode whose
elements were completely selected in the previous mode.

This patch does not change blenders default behavior but offers
implicit selection mode conversion as an alternative. To access it,
hold either the left or right CTRL keys and click on a selection mode
in the view 3d selection mode header buttons. This can be accessed via
the CTRL-TAB selection mode switching as well, simply hold CTRL while
clicking the mode you want or entering its number on the keypad.

In some programs, such as Wings and Mirai, it has been demonstrated
that it can also be very useful to exploit selection mode switching to
implicitly select previously unselected elements as well. For instance
switching selection mode from vertex to edges will select all edges
currently associated with the currently selected vertices. The same
behavior is applied to switching between vertex->face and
edge->face. By exploiting this sort of selection conversion complex
selection sets can be built quicker.

Furthermore I modified blenders UndoMesh code to make selection mode
switching "undo coherent". Aside from its relevance to inclusive
selection mode conversion, this really counts as a "bug" in my
mind. Previously selection mode switch could cause the selection state
of the mesh to be invalid when certain modeling operations were
undone. An example of this would be "edge subdivide-> switch to face
mode-> undo"; you end up with edges selected while still in face mode!


# Part Two: Log for this Commit

-> Code Cleanup

As per Ton's request I reformatted all my code, changed variable names
and eliminated my use of "LinkNode" structs and replaced them with
"ListBase" instead. There should be no warnings while compiling now
either.

-> Remove doubles bug

Fixed small problem in removedoublesflag() in editmesh_tools.c that
caused editface structs to get their UV's scrambled. Vertex colors
might not be safe though? Need to investigate later.

-> Small bug in in the the code for merge last/first

It could cause a crash when exiting editmode, switching meshes, then
entering editmode again. "lastvert" and "firstvert" pointers are now
set to NULL whenever exiting editmode now (see load_editmesh() in
editmesh.c). I will find a better solution to this *soon*...

-> All merge tools now UV aware (optional)

The default behavior is to leave UVs alone, but if you hold CTRL while
clicking on the menu entry, UV's are merged. This works fine in most
situations, although some investigation into how to best handle
merging of UVs at the border of UV islands needs to be done.

This last item brings up a point about the current state of the
interface: several functions accessed through the WKEY menu now use
the CTRL modifier to change how they behave (This convention has been
in place for a while, see subdivide for example). Unfortunately there
is no way to communicate the way modifier keys change the behavior of
certain functions to the user. This makes such options invisible for
all intents and purposes...
2006-02-22 02:17:56 +00:00
86e9faad70 A small alteration for C syntax, code and vars mixed up (MSVC complained about this). 2006-02-14 17:55:55 +00:00
1f21e2eea7 Modified Files:
source/blender/blenlib/BLI_editVert.h
 	source/blender/include/BIF_editmesh.h
 	source/blender/src/edit.c source/blender/src/editmesh.c
 	source/blender/src/editmesh_lib.c
 	source/blender/src/editmesh_mods.c
 	source/blender/src/editmesh_tools.c
 	source/blender/src/header_view3d.c
Log:
	Commit of the 'upgraded merge tools' (Patch #3345) and 'inclusive selection mode conversion' (Patch #3768).
2006-02-13 22:49:46 +00:00
f47899fc0f Orange; merger with bf-blender.
(Merging is *not* fun work, especially not with bugfixes in main branch
for code that got cleaned up in the other! Poor Hos... :)
2006-01-03 21:43:31 +00:00
Chris Want
b41a476401 As positively recieved on the mailing list and irc (and blessed by
guitargeek), this commit enhances the support for temporary storage
for the structs EditVert, EditEdge, and EditFace. The field
"EditVert *vn" has been removed and replaced by a union called
"tmp" that can hold:

 v,  an EditVert pointer;
 e,  an EditEdge pointer;
 f,  an EditFace pointer;
 fp, a float pointer;
 p,  a void pointer;
 l,  a long;

Please see the mailing list post here for more information about
this:

http://projects.blender.org/pipermail/bf-committers/2005-December/012877.html
2006-01-03 17:22:42 +00:00
7837866b1e Getting rid of an unused var 2005-12-24 17:06:14 +00:00
e4aa20fe2e Update for Shape Vert Propagate...
now sets RECALC for all objects that share the obedit's mesh data. So no more TAB-TAB nonsense :)  One caveat: Undo is on Global Level not editmode level.

Also added header note for Copy Shape Vert that MMB does 100% copy
2005-12-24 16:49:02 +00:00
1276dd73ef Some bugreports from the orangers for Shape Vert Copy :)
1. Selection is now not lost on cancel
2. Subsurf now Updates
3. MMB copys at 100% immediately
4. Full copy removed from menu since due to #3
2005-12-23 15:20:27 +00:00
04e24d868e Additional Shape Vert Copy Tools in editmode WKEY
Copy Shape Verts Blend (interactive blending copy)
Propagate Verts (copys selected verts from current to all other shapes)

UI for interactive needs work and Propagate verts needs tidying up, propagation does not show yet until TAB :(
2005-12-22 21:59:56 +00:00
15766e1612 Copy Shape Verts
In mesh editmode, while editing a shape, select some verts, W Key, "Copy Shape Verts". You will be presented with a list of shapes and once chosen, the selected verts will be moved to the position of the verts from the chosen shape. Most handy use would be reverting part of a shape back to basis e.g.

Making eyebrow shapes, add a key and model the eyebrow shape symetrically with the x-mirror tool
Go out of editmode, copy that shape
Go into each shape and revert 1 side to basis

If the mesh has had verts added/removed since last entering editmode, you need to TAB-TAB first before copying
2005-12-21 21:37:11 +00:00
b05433a095 Bug #3522
Fix from Ken Hughes, just checking a few more faces looking for 'double faces' in removedoublesflag.
2005-12-19 19:39:24 +00:00
fe74c08510 Tri-Triple Subdivide filling was messed up. This should straigten it out when cuts > 2 2005-12-18 20:50:32 +00:00
57aac76f45 Bugfix #3471
- Editmode Mesh: after a split command, normals were not recalculated

ALso: in Particle buttons, made the "Tex" button go to the maximum of 10
channels.
2005-11-26 18:38:54 +00:00
5fa3d74d3c Bugfix #3153
Subdivide didn't correctly calculate new UV or vertexcolor yet.
2005-11-21 17:48:20 +00:00
ef19dfbbb2 Fixed two small glitches in Mesh ripping (Vkey):
- loose edges got accidentally removed
- when a rip results in loose vertices, they now get removed too.
2005-11-03 15:57:31 +00:00