Commit Graph

205 Commits

Author SHA1 Message Date
32255b65df - added DerivedMesh.drawMapped{VertNormals,FaceNormals,FaceCenters}EM
functions and implementation for EditmeshDerivedMesh
 - switch drawobject to drawing normals/centers through the DerivedMesh
 - added G_DRAW_VNORMALS flag and button, implementation is not yet complete
   because editmesh normals are not updated regularly
 - switch editmesh draw buttons to use uiDefButBit (can't we get some
   monkey to convert all of the uiDefBut calls with TOG|BIT type? It
   makes grepping the source much nicer)
2005-07-23 07:45:39 +00:00
33709bf6e2 - shuffled editmesh derived function name/function
- added ModifierTypeInfo.freeData function
 - added modifier_{new,free] utility function
 - added ccgSubSurf_getUseAgeCounts to query info
 - removed subsurf modifier faking (ME_SUBSURF flag is no
   longer valid). subsurf modifier gets converted on file load
   although there is obscure linked mesh situation where this
   can go wrong, will fix shortly. this also means that some
   places in the code that test/copy subsurf settings are broken
   for the time being.
 - shuffled modifier calculation to be simpler. note that
   all modifiers are currently disabled in editmode (including
   subsurf). don't worry, will return shortly.
 - bug fix, build modifier didn't randomize meshes with only verts
 - cleaned up subsurf_ccg and adapted for future editmode modifier
   work
 - added editmesh.derived{Cage,Final}, not used yet
 - added SubsurfModifierData.{mCache,emCache}, will be used to cache
   subsurf instead of caching in derivedmesh itself
 - removed old subsurf buttons
 - added do_modifiers_buttons to handle modifier events
 - removed count_object counting of modifier (subsurfed) objects...
   this would be nice to add back at some point but requires care.
   probably requires rewrite of counting system.

New feature: Incremental Subsurf in Object Mode

The previous release introduce incremental subsurf calculation during
editmode but it was not turned on during object mode. In general it
does not make sense to have it always enabled during object mode because
it requires caching a fair amount of information about the mesh which
is a waste of memory unless the mesh is often recalculated.

However, for mesh's that have subsurfed armatures for example, or that
have other modifiers so that the mesh is essentially changing on every
frame, it makes a lot of sense to keep the subsurf'd object around and
that is what the new incremental subsurf modifier toggle is for. The
intent is that the user will enable this option for (a) a mesh that is
currently under active editing or (b) a mesh that is heavily updated
in the scene, such as a character.

I will try to write more about this feature for release, because it
has advantages and disadvantages that are not immediately obvious (the
first user reaction will be to turn it on for ever object, which is
probably not correct).
2005-07-21 20:30:33 +00:00
b58f7d0c55 - change mesh_get_derived_render to mesh_create_derived_render (always
builds new DerivedMesh... caching can come later)
 - split DerivedMesh returning functions into editmesh and mesh groups
 - got rid of DL_NORS displist type (get built on fly for mesh when
   needed)
 - got rid of Mesh.disp (yay!)
 - started to punch DerivedMesh returning functions into shape to introduce
   modifier stack
2005-07-19 00:21:01 +00:00
033f3d5126 - switch shadeDispList to always using DispListMesh from
mesh_get_derived_final... a bit slower atm because of extraneous
   copying (will be fixed shortly) but normals are correct for deformed
   meshes now (don't think they ever have been)
2005-07-17 18:37:27 +00:00
726aea881c - convert mesh_modifier to return deformed verts instead of
leaving in a DL_VERTS type displist (and modifying mesh)
 - removed DL_VERTS displist type (woot woot)
 - makeDispListMesh now puts deformed verts in object->derivedDeform
 - switch over other system parts to new deformed vert storage,
   still kinda hacky and maybe some inconsistencies... will be
   sorted out soon enough.
 - moved build_particle_system to makeDispListMesh... this may have
   adverse side effects, needs to be sorted out with depgraph system
2005-07-17 17:41:03 +00:00
80327e675a - converted draw_tfaces3d and bbs_mesh_solid to use
mesh_get_derived_deform... (whats that? more general AND it uses less
   lines? how can that be!!!)
2005-07-17 03:48:29 +00:00
67d58c0f45 - added DirectMesh.getVert{Co,No} functions
- added mesh_get_derived_deform function (always returns a DerivedMesh
   corresponding to deformed (but not subdivided) mesh). used in places
   where original mesh is to be displayed but with deformed coordinates
   (vpaint for example).
 - added DirectMesh.getVert{Co,No} implementations for MeshDerivedMesh
 - updated vpaint to use mesh_get_derived_deform
2005-07-17 01:18:59 +00:00
e67ba0ae33 More armature goodies;
The B-Bones!
(where the B can be read as 'block' or 'bezier' or 'b-spline')

- set option on/off in edit buttons, armature panel
- scaling of B-bones only works in editmode, use ALT+S to make bones fatter
  or thinner. Also works for constrainted transform
- In pose mode, you now have a buttons panel with per-bone settings too
  Here you can find the "segments" button, which allows bones to
  interpolate between previous/next bones, including roll.
- Buttons to control interpolation ("In" and "Out" are disabled, doesn't
  work satisfying yet

NOTE: this doesn't give deform yet! Main purpose for now is to test if this
drawing method serves to animate/pose armatures well.
Still need to review proper interpolation methods... maybe bezier is too
limited.
2005-07-16 19:07:02 +00:00
573f86bc3c - remove some redundant drawing code
- mousewheel zooming in drawipo used uninitialized var (MSVC run time
   error).
2005-07-15 15:00:08 +00:00
480b8ce10b - switch em_{vert,solid,wire}offs to be unsigned
- some other twiddles to fix mixed signedness compiler warnings

And from the "Dear lazy programmers" file: After you have extern declared
a variable 5 or more times at the top a function, you would have actually
saved a lot of effort by just putting it in the header where it belonged.
Or perhaps you thought by hiding it no one else would notice you were
using global variables to pass information around. Tsk tsk.
2005-07-14 22:16:38 +00:00
8da29921ba - added mesh_get_texspace (should be used instead of direct access)
which calculates texspace on demand if need be.
 - removed almost all calls to tex_space_mesh

There may be a few corner cases where this goes wrong (meshes with vertex
keys) but these should get ironed out by coming modifier system.
2005-07-14 21:57:18 +00:00
3929802335 - switch several instances of makeDispList to use more specific version 2005-07-14 18:14:19 +00:00
b22e3414ca - add mesh_get_bb function to return mesh boundbox and calc if needed
- switch all mesh boundbox access to go through mesh_get_bb
 - switch object_handle_update to call mesh_changed instead of making
   the displist data immediately (delayed calculation)
2005-07-14 18:04:27 +00:00
aa454cd412 - switch to using DAG_object_flush_update instead of mesh_changed
- mesh drawing calculated derived surface before clipping to view matrix,
   waste for offscreen objects
2005-07-14 17:10:44 +00:00
f265d4925a Bug reported by Guillaume LeCocq
Setting both 'xray' and 'transp' did not work proper. Had to add one
extra check, and switch drawing order. Now a transparent object gets
drawn OK as Xray too. :)
2005-07-14 15:49:31 +00:00
e5a639a161 New:
- XRAY draw for armatures now is generic "Draw Extra" option for any
  Object type. This feature just moves drawing to the end, after clearing
  the zbuffer again.
- Solid draw mode now displays materials with Alpha, with the new
  "Draw extra" option "Transp" set. This also moves drawing transparent to
  the end, but it doesn't sort the transparent faces. Still looks OK.
  Note: this is not enabled in mesh editmode. Here all the fancy extra
  drawing just makes it nearly impossible to do OK.
- Re-ordered Object Buttons -> "Draw" panel

Fixes:

- do_versions had check for the UserDef in it (new ogl texture cache).
  that can't be there, should be in usiblender.c (stupid exception).
- same error caused reading older files to not always fix version
  changes on armatures (commit yesterday).
- Outline select drawing happened also on picking-select draw, needless
  slowdown.
2005-07-14 12:44:33 +00:00
682c51663e Previous commit for Xray bones disabled selection of bones. Overlooked one
if()...
2005-07-13 20:21:54 +00:00
2bde6502f2 - Change DerivedMesh.drawSolidFaces setMaterial argument to return
boolean value indicating whether faces with that material should
   be drawn or not.
2005-07-13 20:16:35 +00:00
75ae1ae5ef Armature "XRay mode" now draws nicely with solid too. For it to work, I
had to add a new feature to the 3d window, to collect "after draw" objects,
which get drawn as last, after a clear of the zbuffer.

Same method can be used for nice OpenGL transparent draw, the system is
ready for it, do that later.

The huge commit is caused by cleaning up globals from struct Global. Many
variables were unused or just not needed anymore. Did that to move the ugly
G.zbuf to where it belongs, in the View3D space struct. :)
2005-07-13 19:42:08 +00:00
1adf750fc3 Cleanup of Armature 3d drawing.
- In Solid drawmode, bones get drawn solid too now. Including Outline-
  selection color, if that's set.
  Disable it by setting Object-buttons "drawtype" for the Armature.
  Color used for solid bones is in Theme editor.
- EditMode armature now follows (Mesh edit) theme colors (Vertex, Edge)
- PoseMode armature has ThemeColor for selection, and draws three extra
  colors now;
   - blue shade for bones with action Ipos
   - yellow for bones with IK
   - green for bones with a constraint
- "X ray" now only works for PoseMode... needs review, can be done better
- "Draw Names" option uses theme color too, also indicates selection.

Fixes;

- In Armature EditMode, the deformed Mesh goes to rest-position
- Border select didn't clear 'active' flag in Bones in PoseMode
- Mouse-click select didn't work when a dashed line was close to Bone
2005-07-12 15:47:53 +00:00
ef4bc76dc7 - add missing includes for lazy programmers who don't read error msgs 2005-07-09 18:04:53 +00:00
22a18ecdb8 3D view orbit option: Around Active
This fixes the active object in place when orbiting the view.
	Choppy 15fps demo can be seen there: http://www.elysiun.com/~theeth/bf/around_active.html


Image Memory Grabage Collection
	This adds memory handling to the image code. An image is tagged each time it is used.
	During a collection cycle (frequency of cycles is user defined), if an image is older
	than a user defined limit, its buffer gets deallocated. This also applies to gl memory buffers.
	Images that are loading in GL memory needs to go through two time outs before being fully deallocated: the first time out deallocated the gl memorry, the second the buffer in ram.

	Notes:
		Image buffer loaded from python gets tagged as permanent upon load. That tag is removed when python stops using the image.
		I might have missed some tagging spots, especially in the rendering pipeline. Someone with more knowledge about this code should check to be careful.
		Tagging is done on every access, for rendering, this will probably be a performance hit. A scheme should be developped to only tag when the rendering is completed.
		Collecting is called in draw_object, most likely not the best place to do it.
		Safe from undo, since using undo deallocates memory anyway (like when loading a blend file with one currently opened)


Userpref DNA changes:
	I've changed a couple of flagging variables from short to int. Some because they needed more space, others to keep SDNA happy.


Info window changes:
	I've grouped a couple of buttons in aligned blocks and changed the color of mutually exclusive options to make them clearer.
	Matt didn't do any changes on that in tuhopuu, so hopefully I'm not stepping on anyone's feet with this.


Also changed double constants into floats with f in a couple of places (mostly space.c) to make compiler happier.
2005-07-06 00:33:41 +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
Alexander Ewering
5a7a2e8f78 Fix drawing of text frames inside editmode, stupid error. 2005-06-17 23:30:39 +00:00
Alexander Ewering
97df61a7e5 Initial commit for new text object.
Important notes:

 - Full compatibility with old text objects not fully restored
   (word spacing will be 0.0, need to set it manually to 1.0), will
   either need version upgrade to 238 or a hack. Will check.

 - lorem.c (about to be committed) contains BF copyright notice, but as
   BF did not exist a few hundred years ago, probably best to remove it :)

 - If you notice any cross-platform issues (especially beloved windows),
   please report

 - A few tiny warnings left, I will fix those issues still.

The rest has been said already - so have fun testing. And please do!

=== Reminder:
=== Documentation at http://blender.instinctive.de/docs/textobject.txt ===
2005-06-17 21:04:27 +00:00
25a4b8fa07 Bug #2661
Drawing face stats in editmesh didn't work... a typo caused using the 2nd
point of a face as third one.
2005-06-01 18:36:58 +00:00
53082cf0f1 Bug fix #2575
VertexPaint, FaceSelect draws with 'culled faces' but should therefor
check for negative scaling as well, set the glFrontFace() OK.
2005-05-26 21:00:50 +00:00
563af2aac1 - stiffness circle of MetaElem isn't paint in Object mode now 2005-05-22 19:16:04 +00:00
422b69fe1e UI cleanup work;
Proportional edit:

- Proportional mode added to header as button/menu. Including new option
  to have only connected geometry influenced.
- Added icons for proportional & proportional modes
- Make proportional edit data part of Scene, so all gets saved.
  The Global flag G_PROPORTIONAL was removed
- Made sure #defines get used properly, also tweaked order for proportional
  so it starts with regular 'smooth' by default.
- Use ALT+O in editmode to switch to new proportional 'connected' mode

Other UI stuff:

- in EditMode, the layer buttons get hidden... the amount of icons in
  3d header grows to fast. :)
- made less ugly icons for the Manipulators. Still can be better.
- Added alpha-filter for pre-processing Icon-image, giving nicer display
  of icon-antialising on dark or bright backdrops
- disabled Manipulators when in editmode, and current layers don't show
  the edited data.
- Added the value used to define Normal size (editmode draw) in Scene too,
  so it gets saved.
2005-05-03 10:54:42 +00:00
42126cb5fc Added baking for softbodies.
Works as follows;
- press the 'show bake settings' button (no space left... :)
- define start/end frame for bake, and an interval step.
  The baked result interpolates nicely (Bspline, 4 keys) so in general a
  step size of 2 or 3 still gives OK results.
- Press "BAKE". This will do a full animation + playback. Press ESC if it
  you don't want it.

Once Baked, the BAKE button becomes a FREE BAKE. As reminder the softbody
buttons get blocked with error() menu.

This saves OK in a file. Renders any frame, including fields and moblur.
You can also set a "Timeoffs" for the softbody. And yes, this should be
in the NLA once... :)

NOTE! With this commit, files saved with the old (first commit) version by
Jens Ole won't read the settings back... he stored all sofbody variables in
Object, which was moved to a new struct when I did my first commit on SB
(over a month ago)

Also note that I moved particle deflecting & softbody to a new include.
2005-05-02 13:28:13 +00:00
b7a927cc95 More stats-junk stuff!
Added in Nkey panel (transform properties) option to show in editmode
at choice the global or local coordinate values.
Same option works for the "Tech draw" options. :)
2005-04-29 18:43:17 +00:00
73f88ae286 To please the stats-junkies: the "tech stat" drawing now displays all
values that change during transform().
For the rest drawing sticks to actual selection, making the view quite
less cluttered. Hope this gets approval. :)
2005-04-28 15:41:09 +00:00
3dbae624d3 * Brought over a 'mode' parameter to drawcircball to prevent
further loss of Hos' hair during tuhopuu merges.

This doesn't change any user functionality. 'Mode' can be
GL_LINE_LOOP for a circle outline (as it currently is), GL_POLYGON
for a filled circle, or whatever gl mode you like.
2005-04-20 08:26:22 +00:00
71f619cd23 - make sure object outline doesn't get drawn in faceselect mode 2005-04-14 13:46:49 +00:00
9b354599e0 - fix for bug #2385, mesh outline wasn't drawing in potatoe mode 2005-04-13 11:46:46 +00:00
78939c0cc0 - It is possible to scale radius of MetaElem again.
- It is possible to change dx, dy and dz params in 3Dview with manipulators
    or with some shortcuts (S-X, S-Y, S-Z).
 - User can scale stiffness when green circle is selected.
 - MetaElem is selected with RMB click at green or red circle, then user can
    grab or rotate with MetaElem as usual.

 - Screenshot:
    http://e-learning.vslib.cz/~hnidek/pics/scale_stiffness.jpg

 - Captured video:
    http://e-learning.vslib.cz/~hnidek/captured-videos/scale_stiffness.avi
2005-04-11 19:31:05 +00:00
6fabf998e8 - bug fix #2433, mesh not drawn correctly when only edges
(and Mesh.medge).
2005-04-10 14:31:04 +00:00
b1675a345a - made shadedisplist not free all object displist data...
this messed with data caches which messed with assumptions made
   by drawing code (and was just silly not to mention). here
   be dragons...
2005-04-10 00:00:34 +00:00
7a377bcb05 - Made SoftBody work with Particle Force Fields.
- Added new (Particle) Deflector; type Wind.
  Wind gives constant directional force. It is animatable (Ipos) and reacts
  to Object scaling. Also uses FallOff. Works for particles and SoftBody
  quick movie check; http://www.blender.org/bf/0001_0250.avi
  test file is in download.blender.org/demo/test/wind_soft.blend

- Added MaxDist option for forcefields, to control its influence better.
  Is drawn as circle in 3d window.

Forcefields are a bit weak still... should react to scaling, or not; in
that case drawing should indicate it (done for spherical field now).
2005-04-04 18:09:47 +00:00
ec577aafaa - hidden edges were being drawn when DRAWEDGES was off 2005-04-03 15:13:38 +00:00
0d78b56c5b - mesh was drawing edges underneath selected edges in optimal mode,
waste of time!
 - made solid face drawing respect hidden faces
 - made selection work for hidden face drawing when select visible is on
2005-04-02 18:21:50 +00:00
d4b9ace5ae - adapt to reprototyping in BKE_DerivedMesh.h 2005-03-31 15:57:18 +00:00
aa41e1ddc3 Bug in new drawing code; hack with storing stuff in editvertex->prev did
not get restored OK. :)
2005-03-30 10:12:05 +00:00
347619f501 - fix silly bug in mesh DerivedMesh tex drawing func (only was drawing
first face.
 - change DerivedMesh callback prototypes to help eliminate errors
2005-03-30 05:57:40 +00:00
ae07d869a6 - strange drawing bug, wierd vertices were showing up (wrong
DerivedMesh call)
2005-03-30 05:35:01 +00:00
cfd90889e2 - made some DerivedMesh drawing functions more generic (take callback
to determine if element should be drawn and to set draw options),
   which meant some could be combined - eases implementation of new
   DerivedMesh types and keeps more app specific logic out of DerivedMesh
   implementations.
2005-03-30 00:32:10 +00:00
e229722d5b - added Mesh->derived and Mesh->decimated DerivedMesh pointers
- removed DL_MESH displist type!!!! Now store a DerivedMesh directly.
 - May still be some issues left having to do with releasing this
   at the right time (old code just splashed free_displist all
   over the place).
2005-03-29 16:43:39 +00:00
29aae3452e - added getMappedVertCoEM and drawMappedVertEM to DerivedMesh with
implementations (slightly redundant, could implement draw in terms
   of first... can be cleaned later)
 - switch to use of new APIs... all uses of EditVert->ssco are now
   clean (read: ready to die as soon as a proper DerivedMesh implementation
   is swapped in with ccgsubsurf)
2005-03-28 07:10:32 +00:00
8acfd730cf - added drawMapped{Verts,Edges,Faces}EMSelect calls to DerivedMesh with
implementations
 - updated drawobject selection code to use DerivedMesh (last DispListMesh
   usage in drawobject.c that needs to be replaced! Woot!)
 - interface could still be a lot cleaner, mostly calculating indices for
   the various things to pass to selection color routine is hacky.
2005-03-28 06:46:21 +00:00
a0feaebfa5 - added set_framebuffer_index_color (shortcut for
cpack(index_to_framebuffer(index)) but that is all that is ever
   used.
2005-03-28 05:55:45 +00:00