Commit Graph

49420 Commits

Author SHA1 Message Date
Daniel Dunbar
5bcdd33770 - fix extremely dismal approximation of vertex & face counts for
count_object. It is pretty obvious whoever changed this didn't
   think about it much or test it well... *cough* *cough*.
2005-07-14 17:57:27 +00:00
Ton Roosendaal
ed8d745e0f Armatures now draw bone names over solid.
(commit of initrender.c is just an added comment)
2005-07-14 17:23:26 +00:00
Daniel Dunbar
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
Daniel Dunbar
abbda3a8a1 - use cos not cosf 2005-07-14 15:59:42 +00:00
Daniel Dunbar
6fefc761cc - declare Mesh.mface and Mesh.tface to be of proper type instead of void* 2005-07-14 15:58:32 +00:00
Daniel Dunbar
d22d9ab3c8 - switch to new mesh_set_smooth_flag call (takes mesh object argument
instead of raw mesh)
2005-07-14 15:57:14 +00:00
Daniel Dunbar
a2694df9d0 - removed line that slipped in by accident 2005-07-14 15:50:43 +00:00
Ton Roosendaal
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
Daniel Dunbar
befc2bbc41 - split makeDispList into makeDispList{Mesh,MBall,CurveTypes}, there is
still a makeDispList that dispatches to the appropriate one.
   makeDispList is on the way out and this makes it easier to track down
   exactly which places use makedispList and for what types of objects.
 - switch calls to makeDispList to appropriate more specific function (if
   the object type is known by caller).
 - added mesh_changed function that invalidates cached mesh data (but does
   not rebuild, mesh data gets rebuilt on access). Most old calls to
   makeDispListMesh use this instead now.
2005-07-14 15:48:01 +00:00
Daniel Dunbar
1261dc7e4e - part of DerivedMesh interface change from yesterday that got left out 2005-07-14 15:30:30 +00:00
Ton Roosendaal
274e4f5a1f Bug fix #2799
Sequence effect "gamma cross" didn't work since 2.36. Caused by not
initialized gamma tables...
2005-07-14 13:50:48 +00:00
Ton Roosendaal
4a14cb6f01 Bugfix for #2826
Initialize shadow buffer lamp accidentally altered the ob->obmat for the
lamp. Never showed up before until now (depgraph).
2005-07-14 13:44:59 +00:00
Ton Roosendaal
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
Ton Roosendaal
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
Martin Poirier
256a5cd2c0 Databrowse needed new code to handle the hide dot file correctly.
Added a comment explaining what and why.

Also added a couple of explicit cast to make compiler whine less (double to float mostly).
2005-07-14 06:25:02 +00:00
Joseph Gilbert
b89035906d Mathutils update
- also included is some fixes for preprocessor inclues and some clean up of the previous commit

-rewrite and bugfixes
  ----------------------------------
  Here's my changelog:
  -fixed Rand() so that it doesn't seed everytime and should generate better random numbers
  - changed a few error return types to something more appropriate
  - clean up of uninitialized variables & removal of unneccessary objects
  - NMesh returns wrapped vectors now
  - World returns wrapped matrices now
  - Object.getEuler() and Object.getBoundingBox() return Wrapped data when data is present
  - Object.getMatrix() returns wrapped data if it's worldspace, 'localspace' returns a new matrix
  - Vector, Euler, Mat, Quat, call all now internally wrap object without destroying internal datablocks
  - Removed memory allocation (unneeded) from all methods
  - Vector's resize methods are only applicable to new vectors not wrapped data.
  - Matrix(), Quat(), Euler(), Vector() now accepts ANY sequence list, including tuples, list, or a self object to copy - matrices accept multiple sequences
  - Fixed Slerp() so that it now works correctly values are clamped between 0 and 1
  - Euler.rotate does internal rotation now
  - Slice assignment now works better for all types
  - Vector * Vector and Quat * Quat are defined and return the DOT product
  - Mat * Vec and Vec * Mat are defined now
  - Moved #includes to .c file from headers. Also fixed prototypes in mathutils
  - Added new helper functions for incref'ing to genutils
  - Major cleanup of header files includes - include Mathutils.h for access to math types
  - matrix.toQuat() and .toEuler() now fixed take appropriate matrix sizes
  - Matrix() with no parameters now returns an identity matrix by default not a zero matrix
  - printf() now prints with 6 digits instead of 4
  - printf() now prints output with object descriptor
  - Matrices now support [x][y] assignment (e.g. matrix[x][y] = 5.4)
  - Matrix[index] = value now expectes a sequence not an integer. This will now set a ROW of the matrix through a sequence.  index cannot go above the row size of the matrix.
  - slice operations on matrices work with sequences now (rows of the matrix) example:  mymatrix[0:2] returns a list of 2 wrapped vectors with access to the matrix data.
  - slice assignment will no longer modify the data if the assignment operation fails
  - fixed error in matrix * scalar multiplication
  - euler.toMatrix(), toQuat() no longer causes "creep" from repeated use
  - Wrapped data will generate wrapped objects when toEuler(), toQuat(), toMatrix() is used
  - Quats can be created with angle/axis, axis/angle
  - 4x4 matrices can be multiplied by 3D vectors (by popular demand :))
  - vec *quat / quat * vec is now defined
  - vec.magnitude alias for vec.length
  - all self, internal methods return a pointer to self now so you can do print vector.internalmethod() or vector.internalmethod().nextmethod() (no more print matrix.inverse() returning 'none')
  - these methods have been deprecated (still functioning but suggested to use the corrected functionality):
    * CopyVec() - replaced by Vector() functionality
    * CopyMat() - replaced by Matrix() functionality
    * CopyQuat() - replace by Quaternion() functionality
    * CopyEuler() - replaced by Euler() functionality
    * RotateEuler() - replaced by Euler.rotate() funtionality
    * MatMultVec() - replaced by matrix * vector
    * VecMultMat() - replaced by vector * matrix
  -  New struct containers references to python object data or internally allocated blender data for wrapping
  * Explaination here:  math structs now function as a 'simple wrapper' or a 'py_object' - data that is created on the fly will now be a 'py_object' with its memory managed by python
  *    otherwise if the data is returned by blender's G.main then the math object is a 'simple wrapper' and data can be accessed directly from the struct just like other python objects.
2005-07-14 03:34:56 +00:00
Johnny Matthews
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
Ton Roosendaal
967e294d9c Three fixes;
- Armature editmode, while armature was deforming children, was very slow
  because it kept making subsurfs... this goes still hackish :)
- CTRL+A on armatures used loadsa old code, removed all of it! Still works.
- Using "Set smooth" or "Set solid" on file loaded without 3d window
  crashed
2005-07-13 21:28:43 +00:00
Ton Roosendaal
682c51663e Previous commit for Xray bones disabled selection of bones. Overlooked one
if()...
2005-07-13 20:21:54 +00:00
Daniel Dunbar
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
Ton Roosendaal
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
Johnny Matthews
64af8d0ced If loopcut was cancelled, the screen was not refreshed to get rid of the last preview line.
Thanks to Desoto for reporting.
2005-07-13 19:39:01 +00:00
Johnny Matthews
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
Johnny Matthews
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
Ton Roosendaal
6a648da13f Another old bug bites the dust! Actually the error was simple... but
thanks to depgraph it executes nicely now. :)

#bug 2397: frame-duplicator using Constraint not evaluated.
2005-07-13 13:56:15 +00:00
Ton Roosendaal
542358265b Couple of small fixes;
- cleaned up 'version correction' a bit. There was code slowing down
  current files even (armatures were evaluated all, even when not in
  current layer, was added to make sure they get converted OK).
  Send me old files that crash now! :)
- on reading older files with path-constraints, a fix had to be added.
- error "badd call to addqueue' found when using header-less window for
  filewindow
2005-07-13 13:30:51 +00:00
Ton Roosendaal
3135b3ab83 Removed initializer str = "";
Seems to give issues in MSVC, and wasn't needed after all.

Further fixed dependencies in constraints between armatures and armatures.
It didn't update the other armature when the armature-object itself moved.
2005-07-13 08:56:07 +00:00
Ton Roosendaal
6787e21a63 Two little bugskis;
- Solid armature drawing didn't do well for negative scaled armatures
- Layer Ipos were not evaluated for invisible objects (there goes another
  exception bypassing dependency...!)
2005-07-12 17:46:39 +00:00
Daniel Dunbar
f4e1ea0b62 - add missing include 2005-07-12 17:26:19 +00:00
Alexander Ewering
6f5b3b10c8 Fix "Replace Meshes" in radiosity to actually only replace Meshes, and not
also delete lamps, cameras and anything else that was selected in the
"Collect Meshes" phase.
2005-07-12 16:24:27 +00:00
Ton Roosendaal
f6bd2ad3d0 ACK! Forgot to add the new drawarmature.c file. :) 2005-07-12 16:02:50 +00:00
Ton Roosendaal
ab45b910cd Constraint "influence" slider didn't work once there was an ipo assigned
once. Variable got initialized too often. :)

Oh! Here's a nice webpage about the previous commit:

http://www.blender3d.org/cms/Armature_draw_modes.629.0.html
2005-07-12 16:00:47 +00:00
Ton Roosendaal
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
Daniel Dunbar
d7ab2a584e - added missing include 2005-07-12 13:50:42 +00:00
Martin Poirier
f16ddaba04 The hide .data code didn't work correctly when databrowse is used to return something (when selecting a datablock, not just browsing).
It only counted visible blocks, but to get a valid index, it has to count invisible ones too.

Fixed
2005-07-12 03:37:16 +00:00
Martin Poirier
1b466f7765 Hide .file blocks in databrowse/pop menu.
This is mainly useful for scripts that generate/load datablocks for their own use and don't want to burry the user under an avalanche of datablocks he/she doesn't care about.

This adds a user pref "Hide .data" which now acts as a default value when opening a new fileselector.
It is also used when creating data select pop menus.

The "ghost" button in a fileselect window is independant from the userpref. It can be turned on/off individually without affecting

Note: When turning the option on/off, it sometimes take a couple of times before the pop menu registers it. Probably some caching thing. Will have to look at it.

Default value is Off.
2005-07-11 23:49:06 +00:00
Martin Poirier
0c0205ad78 My Radiosity commit had some code from my base list ordering experiement. (It wasn't removed because it didn't use the macros)
Caused radio to often say "no vertices" when that was obviously untrue.
2005-07-11 23:23:06 +00:00
Ton Roosendaal
01daf04ea6 - Object buttons, Hooks panel, clear offset didn't redraw correct
- Particle panel was drawing in wrong size
2005-07-11 19:31:15 +00:00
Ton Roosendaal
03c255ac1d New: Armature editmode/posemode now react correctly to HOME or Numpad-DOT
for viewing all or only selection nicely centered.

Fix: Poses without NLA or Action were reset to restposition on file read
or exit editmode.
2005-07-11 17:12:33 +00:00
Daniel Dunbar
7d80ffa538 - added bglVertex3f call (to match bglVertex3fv) 2005-07-11 17:06:03 +00:00
Ton Roosendaal
4c4de10cf8 Fix: Prevented depgraph to execute do_all_actions when you paste a poste. 2005-07-11 15:38:51 +00:00
Ton Roosendaal
70271db367 Corrected the Armature option "Delay deform", which doesn't update its
children during transform... to make it work, had to trick the nice
depgraph code... <sob> :)
2005-07-11 13:59:02 +00:00
Ton Roosendaal
a17e21dfab SLightly altered rule for the new IpoCurve option "Keep horizontal on
extrema". It now also keeps auto-handles horizontal when the Y coordinate
is exactly identical.

And; made this option default on inserting new curve/keys.
2005-07-11 12:31:15 +00:00
Ton Roosendaal
85aca9bba1 Fix for bug #2747
Knife cut in edge selection mode can cause crashes, since it uses subdivide
which isn't edge-select aware yet.
Quickly patched it by making knife checking on vertex selection.

Johnny: undo this change when you add the new subdiv code, good test for if
it works as well! :)
2005-07-11 11:58:29 +00:00
Martin Poirier
10c4c6463c Boundbox select object mode optimisation.
Changed selectprojektie (and renamed to view3d_opengl_select as suggested by Ton) to accept a buffer size, so boundbox can adapt it's buffer size to the number of object in scene.
Also, the loop is done more smartly, since glSelect fills the buffer in the same order as the drawing order, so we save lops of looping on unselected object (which used to go through all the buffer before finding that they weren't selected).

This scheme could probably be applied to all the other loops using glSelect. (good project for newbie coders)
2005-07-11 11:09:26 +00:00
Ton Roosendaal
8301d7ad00 Bug fix #2762
Quite harmless, but was lazy code...
When you choosed "Vertex Color Paint" material, the init_render_material()
also set the "Vertex color Light" option, because that flag was checked on
during render to detect vertex colors.
Now it has proper checks in render code.
2005-07-11 11:01:06 +00:00
Martin Poirier
54cd0cf56d This commit fixes radiosity to correctly preserve and subdivide UV
coordinates.

  Known problem: Pin status bleeds a bit, so new subdivided UVs around
points that were original pinned can end up pinned in the end. Could be
fixed, or could just drop pinned status entirely.

Also, when gathering meshes, it doesn't add materials twice, so it's harder to bust the 16 materials limit.
2005-07-11 10:48:14 +00:00
Ton Roosendaal
9cb84a662e Bug fix #2763
Depgraph missed proper relation from one armature bone to another armature
bone. Interesting rig setup for facial animation by Malefico! :)
http://projects.blender.org/tracker/index.php?func=detail&aid=2763&group_id=9&atid=125
2005-07-11 09:46:05 +00:00
Ton Roosendaal
0c197b211b Bugfix for #2768
Starting a Bake for SoftBody didn't initialize the animation system for the
first frame correctly, causing an initial unwanted softbody effect.
2005-07-11 09:27:35 +00:00
Ton Roosendaal
0fa1e2dcc7 Bug fix #2772
EditMesh undo didn't restore vertex colors! That slipped our attention for
almost a year... :)
2005-07-11 09:17:43 +00:00