Commit Graph

98 Commits

Author SHA1 Message Date
f00b5c78d4 In edgeslide if Draw Edge Length is on, the rail edges will be temporarily selected so that actual new edge length can be seen. 2005-08-20 16:38:05 +00:00
a30740c196 - convert all DerivedMesh map functions to use index based
mapping (instead of Edit{Vert,Edge,Face} pointers)
 - dropped convertToDispListMeshMapped (whew, glad of it too)
 - added DerivedMesh drawMappedFaces function
 - dropped EM suffix for DerivedMesh functions, it was neither
   particularly correct nor descriptive
 - converted test_index_mface to test_index_face that also corrects
   MCol and TFace. Good thing we had three versions of this routine,
   you never know when one might burn down.
 - removed flipnorm_mesh, not used anymore (and was incorrect to
   boot)

 - Getting face select to work with modifiers turned out to be much
   more complicated than expected. Reworked mapping architecture for
   modifiers - basically elements in a DispListMesh are now required
   to be stored in an order that corresponds exactly to original
   ordering. MVert/MEdge/MFace all have a new flag ME_XXX_STEPINDEX
   that is set on each element that is set on the first derived element
   of each original element. I can't say the code to follow these
   requirements for subsurf is particularly transparent, but on the
   upside it is a reasonably consistent and simple system that is memory
   efficient and allows keeping the DispListMesh structure.

 - rewrote mirror modifier to be simpler/conform to new requirements
   for mapped DispListMesh structure. This also means that mirror interacts
   much better with incremental subsurf calculation (it used to recalc
   one entire side on any topology change, now it generally avoids that).

 - added EM_{init,free}_index_arrays and EM_get_{vert,edge,face}_for_index
   functions to handle mapping indices back into appropriate EditMesh
   structures.
 - bug fix, make edges didn't recalc object data
 - bug fix, initial image assignment to TFace's didn't recalc object data

 - new feature, added circle select support for FACESELECT
 - bug fix, creating new faces in editmode duplicated the TFACE active
   flag - but there should only be one active tface
 - bug fix, possible crash when deleting all faces in faceselect mode
   on mesh with tfaces...

Still todo: TFace edge drawing is still not always correct in face
mode, in particular with a mirror modifier when mesh has edges (and
no preceeding subsurf). Have not yet decided how to deal with this.
Best solution is probably to do switch to meshes all having MEdge's,
in which case I can get rid of TFace edge flags (and need to recalc
modifiers on tface selection change).
2005-08-20 03:08:23 +00:00
2872263377 - New feature: shift+ctrl+t in Mesh editmode splits quads in exact opposite
way. Requested for low-poly modeling.

- fix: on exit editmode, the code always created a mesh->dvert block...
  silly, this made other code confused which decided whether to use
  dverts (vertex groups) or not.

- removed obsolete call from armature.c. Also fixed name of function there,
  preparation work for nicer support in Blender for "deform envelopes"
2005-08-17 13:26:42 +00:00
0c7f65d152 - added view3d_get_object_project_mat function, returns mat to project
object cos into screenspace without mucking with gl matrices.
 - added view3d_project_ functions, take arguments instead of using
   globals
 - removed View3D.{mx,my,mxo,myo}
 - switch drawobject foreachScreenVert functions to use new projection
   functions
 - switch edge slide to use new projection functions, fixes erratic
   behavior (project was using wrong mat I believe)
 - bug fix in edgeslide, nearest edge to start was one-off
2005-08-15 04:10:02 +00:00
f47f8d9418 Patch provided by Campbell Barton; this makes the editmode Mesh CTRL+T
"convert to triangles" check for shortest diagonal to decide how the
triangles will be made.

Fun todo for another occasion; check on facenormals too...
2005-08-14 10:58:17 +00:00
93aeb6b318 - added make_orco_curf, even does keys!
- removed {lattice,curve}_modifier functions
 - changed render code to use displist for curve rendering
   instead of making its own. required adding a bevelSplitFlag
   field to DispList. I also fixed the bevel face splitting
   which did not work correctly in many situations.
 - changed so all curve data creation happens in makeDispListCurveTypes,
   includes making bevel list and filling polys
 - changed render code to use displist for surface rendering
 - removed Curve.orco variable, built as needed now
 - removed stupid BLI_setScanFill* functions... why use a function
   argument when you can use a global and two functions! Why indeed.
   (this fixed crash when reloading a file with filled curves and
   toggling editmode)
 - bug fix, setting curve width!=1 disabled simple bevel for no
   apparent reason
 - cleaned up lots and lots of curve/displist code (fun example:
   "if(dl->type==DL_INDEX3 || dl->type==DL_INDEX3)"). Hmmm!
 - switched almost all lattice calls to go through lattice_deform_verts,
   only exception left is particles
 - added DBG_show_shared_render_faces function in render, just
   helps to visualize which verts are shared while testing (no
   user interface).
 - renamed some curve bevel buttons and rewrote tooltips to be
   more obvious
 - made CU_FAST work without dupfontbase hack

Also by the way I wrote down some notes on how curve code
works, nothing spiffy but it is at:

http://wiki.blender.org/bin/view.pl/Blenderdev/CurveNotes
2005-08-14 06:08:41 +00:00
75bcb4cd98 - added modifiers_getVirtualModifierList, returns pointer to first modifier
but including "virtual" modifiers (for example, an object skel-parented
   to a lattice has a virtual first lattice modifier)
 - removed mesh_modifier(), all functionality has been incorporated into
   modifier stack (well, keys still don't exist as a modifier, but I am
   not sure if they should).
 - added interface option to convert a virtual modifier into a real modifier
 - added option to parent to lattice object or lattice with deform
 - bug fix, patch of hook indices patched all hooks (oops) not just ones
   for edited mesh

NOTE: Files saved with 2.38 that include an object parented to a lattice
will not load correctly, because it will look like the object is parented
only to the object (i.e. without deform). Can be simply fixed by reparenting
or adding a lattice modifier. Older files are handled automatically.
2005-08-11 03:31:33 +00:00
9030e5f686 - added eModifierTypeFlag_RequiresOriginalData for modifiers that
can only follow deform (for example, they store mesh vertex
   indices)
 - added ModifierType.foreachObjectLink for iterating over Object
   links inside modifier data (used for file load, relinking, etc)
 - switched various modifiers_ functions to take object argument
   instead of ListBase
 - added user editable name field to modifiers
 - bug fix, duplicate and make single user didn't relink object
   pointers in modifier data
 - added modifiers to outliner, needs icon
 - added armature, hook, and softbody modifiers (softbody doesn't
   do anything atm). added conversion of old hooks to modifiers.

NOTE-THE-FIRST: User name field is not initialized on loading 2.38 files
so if you have saved stuff with a cvs blender you will see blank names.

NOTE-THE-SECOND: Since modifiers aren't evaluated yet for non-Mesh
objects, hooks for lattices and curves are broken. Don't updated if
you actually, say, *use* Blender.

NOTE-THE-THIRD: Old hooks used a quirky weighting system during
deformation which can't be extended to modifiers. On the upside,
I doubt anyone relied on the old quirky system and the new system
makes much more sense. (Although the way falloff works is still
quite stupid I think).
2005-08-10 22:05:52 +00:00
02f3c930f5 - bug fix, face center drawing was wrong for editmesh
- added several useful utility functions to editmesh,
   these can simplify/clarify a lot of mesh code, check them
   out
 - cleaned up EdgeSlide a bit to be clearer/shorter
     o bug fix, EdgeSlide did not always cancel correctly
     o bug fix, EdgeSlide did not choose initial "control" edge
       correctly after calc_meshverts_ext change
2005-08-10 03:51:34 +00:00
9823e7d548 Removed need for vert-xs and ys in edgeslide 2005-08-09 20:02:53 +00:00
98741ec436 fix for bug #2906
Was allocating array for all hidden edges, not needed, just hidden with a selected vert needed
2005-08-09 14:44:46 +00:00
6aead5176b Possible fix for bug #2906
Added some parens to change eval order
2005-08-09 13:49:05 +00:00
c192b80b17 Big commit, had to rework lots of selection stuff so that things
worked properly with modifiers. Needs more testing I am sure.
No, honestly, I wasn't just cleaning for the hell of it, it
was *necessary* (I would never do such a thing). Selection should
work completely with cage options of modifiers now.

 - added DerivedMesh foreach functions to iterate over mapped
   verts/edges/face centers. These replaced some of the drawing
   functions and are more general anyway. Special edge drawing
   functions remain for performance reasons.
 - removed EditFace xs, ys fields
 - added general functions to iterate over screen coordinates of
   mesh/curve/lattice objects
 - removed all calc_*verts* functions that were used for storing
   screen coordinates in objects. they were recalc'd on the fly
   for most situations anyway, so now we just always do that.
   calc_*verts_ext was one of those calls that did dirty things
   deep down in the callstack (changing curarea and poking at
   matrices)
 - rewrote all vertex level selection routines (circle, lasso, bbox)
   and closest vertex routines (rightmouse select) to use the new
   system. This cleaned up the selection code a lot and the structure
   of selection is much easier to see now. This is good for future
   work on allowing modifiers to completely override the selection
   system. It also points out some discrepancies in the way selection
   is handled that might be nice to resolve (mesh vertex selection has
   fancy stuff to try to help with selecting overlapping, but it only
   works w/o bbuf select, and curves/lattices don't have at all).
 - had to remove ton's code to move Manipulator to cage location, this
   is not reliable (can come up with a different method if requested)
 - as it happens BezTriple.s and BPoint.s are basically available to
   be removed, just need to rewrite editipo code that still does
   background calc of screen coordinates
 - MVert.{xs,ys} are still around because they are abused in some places
   for other info (not sure if this is safe actually, since they are
   short's and the mvert limit went up).

And did I mention this commit is comes out to -305 lines? Well it does.
2005-08-09 08:12:36 +00:00
7f98c960b5 Added extra Select Type option for esubdivide and put them in defines to get rid of magic numbers
SUBDIV_SELECT_ORIG      - Retain selection to look like original selection
SUBDIV_SELECT_INNER     - New selection is all the new inner edges
SUBDIV_SELECT_INNER_SEL - New selection is all the new inner edges except where only 1 edges was selected on a face

Loopcut now uses SUBDIV_SELECT_INNER_SEL for better interaction with edgeslide
2005-08-08 15:59:05 +00:00
fec419a05e Little fix for Edgeslide so it doesn't crash on usage!
Also fixed trying to edgeslide an edge with a missing rail.

And Changed the okee calls to error (thanks intrr)
2005-08-07 23:59:34 +00:00
11e21a8bac Clean up spaces (make into tabs) in editmesh_tools
Also add menu items for Edgeloop Delete
2005-08-07 21:47:08 +00:00
941d5ae44e Fix for bug #2859
Beautyfill didnt work in illustrated case, due to 1) face select 2) no
correct edges selected...
2005-08-07 21:23:55 +00:00
bfcc67267b In CTRL-E menu "Edgeloop Delete" with a valid "inner" edgeloop selected, this function calls other tools to delete that edgeloop by doing the following
Edgeslide to one side 100%
CTRL +  to select "more"
Remove Doubles

Leaves you with new faceloop selected.
2005-08-07 20:46:26 +00:00
843ffdc49a - bug fix, extrude and duplicate automatically enter transform which
may request info from the derived surface, this means we have to
   force a manual recalc before we enter transform... proper design
   of mesh data invalidation/recalc should make this unnecessary...
2005-08-06 19:13:13 +00:00
32656ad7ef Now while choosing an edge in loopcut, S will toggle loopcut smooth. There is a headerprint to show current status of smooth.
Also a little tweak in subd smooth. is still not perfect in full quads/tris cases
2005-08-05 15:52:28 +00:00
46a8c11064 A small improvement to Subdivide multi smooth. It is not perfect yet :( but its better.
BUT! Try doing a EdgeRing (CTRL-ALT-RMB in edge mode) select and a subdivide smooth multi...That works ok (read loopcut multi smooth)  :)
2005-08-05 15:08:43 +00:00
9102983b51 Make Edgeslide work with Subsurf Optimal "on cage" 2005-08-04 19:31:14 +00:00
280e976044 A little feature for Broken...
When choosing Subdivide from the w menu or Confirming the number of cuts in a subdivide multi, hold down the CTRL key and
instead of getting the original selection recreated on the new edges, get the "inner edges" as you would get if doing a loopcut. UI for this may change before release (perhaps a toggle button in edit buttons)
2005-08-02 18:20:36 +00:00
1d2dd4ce75 Adding a little idling to Edgeslide loop, 2005-07-31 20:18:38 +00:00
3b7d40cfdb For edgeslide control rail there are 2 options:
Scroll Up/Down and Left/Right arrow key will cycle through the control edges in either direction.

I got rid of SHIFT for the time being.
2005-07-30 19:50:51 +00:00
9da7ec89ed Edgeslide Mouse Movement Fix
Edgeslide movement is now controlled by a line drawn between the endpoints of the 2 control rail edges. Edgeslide will
try to pick a control rail pair (will color green ATM) if you don't like the edge it picked, use the mouse wheel up to change it.
have to code mouse wheel down to go other direction still. Just ran out of time ATM and wanted to get this in for movement testing.

movement is in 1% per edge (so 1% out of -1 to 1)
CTRL makes it 10%
SHIFT makes it .1%

Se what you think and give me some feedback on functionality :) Code needs cleanup and comments, so don't crit that too much yet.
2005-07-30 16:37:04 +00:00
a2eefbd7c7 Fixed some warning shenanigans 2005-07-30 01:44:15 +00:00
d44e6153d1 Flush Edge selection down to verts in subdivide if you are in Vertex select mode 2005-07-29 20:07:01 +00:00
60dc7730f4 Commented out some debug printfs 2005-07-29 18:54:48 +00:00
0d90195d17 Another UV tweak for subdivide, It seems to work better now, still not perfect 2005-07-29 18:45:40 +00:00
7d797797c8 A Small change on Edgeslide while I try to come up with a better mouse interaction.
Move mouse  - 5%
SHIFT modifier - 1%
CTRL modifier - 10%
2005-07-29 14:20:48 +00:00
26b2648a72 Little issues, combined commit!
- Bug #2857: Spin didn't create nice consistant normals
- removed unnecessary call to where_is_object() in init-render phase.
- Added DAG_scene_sort() calls when objects were removed (join cases)
- When using texture fonts, the file window header didn't display OK
- Saving a file didn't set the 'wait cursor' anymore (oldie!)
2005-07-25 10:58:21 +00:00
fb651ddb4a - change mesh_calc_normals to set vertices with len(no)==0
to normalised coordinate (convention in blender, helps with
   halo)
 - removed vertexnormals(), vertexnormals_mesh()
 - removed CTX_NO_NOR_RECALC (always assume already calculated)
 - change NMesh.c to call mesh_calc_normals
 - chance load_editMesh to call mesh_calc_normals after done
   converting instead of using editmesh normals
 - update recalc_editnormals to also calc vertex normals (whats
   4 more adds and a sqrt among friends)

Its hard to believe, but it just might be the case that there
are only two places mesh normals are calculated now (renderer
and kernel)
2005-07-23 19:03:43 +00:00
0a05783cba Added code in loopcut to undo cut if edgeslide was cancelled. (For you Chris!)
Also Added some code for UV's in subdivide. This is close, but still is not perfect :(
2005-07-23 14:39:59 +00:00
b344db3670 First step towards restoring / improving subdivide 'beauty'.
Beauty button now is Beauty and Short.

Works as follows

Beauty on: If a face is selected, only subdivide the longest 2 sides
Beauty & Short on: If a face is selected, only subdivide the shortest 2 sides

1 problem atm is when more than 2 sides are equal. Must add code to check for this and disable beauty on that face. Use with caution! :)

Also restoring selection needs to be tweaked here.

Side Note: for most accurate subdividing, use edge mode and select only the edges you wish to cut rather than relying on beauty.
2005-07-19 15:37:18 +00:00
8962195f21 Fix for bug #2848 This flushes selection upward in subdivide based on select mode. So faces with all edges selected should now be selected as well. 2005-07-19 02:23:52 +00:00
261bd94e7f Fix: outliner crash on deleting bones in editmode
Further cleaned up editmesh code to be warning free and to have a little
nicer style :)
2005-07-17 15:45:35 +00:00
e0dd08dc52 Part #2 to vert color fix in new subdivide, Please check UV and Vertcolor with new subdivide.
Was checking for a condition < 0 should have been > 1
2005-07-15 18:13:21 +00:00
e85355b710 Part #1 of the fix for UV colors in new subdivide code
UV colors on Tri's should go right now when subdivivded,
for Quads, 3 of the for points should be right. Still working on the 4th.
2005-07-15 16:12:34 +00:00
fc0c2ef251 Adding CTRL stepping for Edgeslide. Mouse control is still not finished here, this is just a temporary fix until it can be done right. 2005-07-14 19:44:10 +00:00
120427e96b Fix for a *very* nasty bug... somewhere in the ancient past - I tracked it
back to 1.4 - comparing pointers apparently gave warnings or errors... I
don't really have a memory of that. Could be the Irix compiler.

What it was used for is sorting edges in arrays or hash lists, like:

  if( ((long)v1) > ((long)v2) )

long is defined to be pointer size, so that should work 32/64 bits, where
it not that the long cast makes the value SIGNED! :)

Ken Hughes discovered this... noting that when his system uses a calloc, the
returned pointer had an uncommon address making the long negative.
It was a very hard bug to track, since (apparently) most OS's have an address
space being still in the lower part of an long...

Anyhoo; I have removed a couple of (long) casts from pointer comparing now,
need to get compile feedback if that's compliant for all our OS's.
If so, quite a lot of such hacks have to be removed from our code, or make
them casting to an unsigned long...

This has been confirmed to fix bugs #2709 and #2710. Thanks Ken!
2005-07-14 13:12:29 +00:00
1bfd0eae14 A few additions/changes suggested by Chris Burt
1. Return and PADENTER confirm loopcut and edgeslide
2. When choosing loop to cut in loopcut, can use numeric entry for number of cuts (less than 130)
3. Number of Cuts in loopcut printed in header
2005-07-14 02:52:51 +00:00
cb694458a6 A warning cleanup from the last commit. Added some explicit casts. Should just be double to float warnings left here now. Will do more later
Also made edgeslide move a little faster for the time being.
2005-07-13 16:33:30 +00:00
798d39dd4c Well here it is. Subdivision/Loop Tools Recode Commit #1
Ton has been pushing me to get this in and finish it up with help, so here is a run down of the commit

Revised Features
	Subdivide now is Edge based, allows for multicut
	Loopcut was recoded, now has multi option
	Knife tool now has multi option

New Features
	Edgeslide
	Edgering select

Removed Features
	Alt-B Edgeloop selection (use alt-RMB in edgemode)
	Shift-R Faceloop selection (use alt-RMB in facemode)
	Old Subdivide (Except for smooth which is left in until new one works)

Todo
	Subdivide Smooth Math is broken - could use some help here (look for alter_co in editmesh_tools.c)
	Tweak mouse control of Edgeslide is hackish ATM
	Add Non-proportional movement  to edgeslide
	Add smooth option to new loopcut

I probably left something out.

See here for more info
http://wiki.blender.org/bin/view.pl/Blenderdev/EdgeSubdivision
2005-07-13 15:20:40 +00:00
3d267e88e3 Fix for Bug #2793.
A really dumb coding error that I made when I coded this. left out brackets around an if block.
2005-07-10 13:45:12 +00:00
7a31d07fda Bugfix #2797
Editmesh SHIFT+F "Fill" used an unsigned char to count amount of selected
edges linking to vertices, but also subtracted... causing the char to
become 255. Gave crashes (or infinite loops) when using "Fill" on random
input of solid meshes.
2005-07-10 09:32:30 +00:00
28a1e8277b Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs

A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;

- The entire object update system (matrices, geometry) is now
  centralized. Calls to where_is_object and makeDispList are
  forbidden, instead we tag objects 'changed' and let the
  depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
  constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
  flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes

Armatures;

Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!

Important to note is;

1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
   That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.

- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
  and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
  for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
  the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
  on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.

TODO NOW;

- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
  (wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
  (But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
  position anymore. That system looks nice (no flips) but is not well
  suited for NLA and background render.

TODO LATER;

We now can do loadsa new nifty features as well; like:

- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
  IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...


Bugfixes;

- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change

-Ton-
2005-07-03 17:35:38 +00:00
9fea86d38a Fix #2709
Editmesh; "Remove Doubles" also included hidden vertices.
2005-06-07 13:04:31 +00:00
b775055107 Tinsy wee buggie; added 'extrude vertices only' to menu that appears when
only 1 face is selected.
2005-05-29 23:40:35 +00:00
7018576bfd Bugfix #2576
The ALT+F "Beauty Fill" could crash, for example on the already legendary
monkey head CTRL+T,J test. :)
Found out there was a necessary check for edge/face selection flags missing
2005-05-18 10:27:52 +00:00