Commit Graph

72 Commits

Author SHA1 Message Date
f4a03182fb === Transform Snap ===
Draw a circle around the snapping point for visual aid.

Different snapping target method, switchable in the 3d view header menu in the Transform menu.

* Closest: Snaps the closest vertex to the point
* Median: Snaps the median of the selection to the point
* Center: Snaps the transform center to the point (this is different from median because you can use Cursor/Boundbox as center)

Fix a bug with constraints/snap handling.
2006-12-19 22:25:07 +00:00
e31478f129 Tiny header include fix for a warning I introduced earlier. 2006-08-11 00:26:35 +00:00
1de0248f6f fixed a typo that must have slipped in ;)
Kent
2006-07-31 04:54:10 +00:00
4f7a5fd641 * Made the proportional edit circle draw inverted against
the background - it was very difficult to see with a muted
grid theme colour.
2006-07-31 02:48:45 +00:00
233348197e === Bug Fix ===
[ #4272 ] Camera zooming problem
Move the camera in camera view could block inexplicably sometimes.

Was a silly programmation error that any competant compiler should have given a warning for. Alas, I'm using gcc...
2006-06-04 18:38:58 +00:00
aab49dff0e === Transform Constraining ===
Bug #3733
Constraining on a perpendicular axis was broken on (half - 1) cases.
Silly oversight on my side which didn't turn out in the test case (moving camera in and out) and only appeared in front view (not side nor top) because of positive reasons.

Frankly, I still think translating an object perpendicular to the viewport is a bit silly, but now, at least, people can be silly in a predictable fashion.
2006-04-10 23:20:18 +00:00
622f914776 New stuff & fixes in Blender OSA filtering.
While investigating alternative filters (Mitchell), I found two small
errors in the Gauss code, it clipped wrong and multiplied wrong, causing
settings other than filter size 1.0 to not work properly.

Took the last-minute liberty to add more filter types in Blender too.
Also wrote an extensive log about how sampling & filtering in Blender
works.

http://www.blender3d.org/cms/Samples_and_Filtering.723.0.html
2005-11-23 15:20:45 +00:00
9ef8c198b2 Transform:
As discussed during meeting, made double key press go for Local when Global was selected.

Two lines of code! ;)
2005-11-20 16:01:56 +00:00
e02336653d Fixed backwardstransform.blend bug from orange dudes.
It was literally two lines of code.

This probably fixes a lot of the "constraining transform goes backward" problems.
Was a dumb oversight on my part.
2005-10-23 21:34:20 +00:00
e0c7d270d9 - assorted minor warning fixes 2005-09-03 16:20:33 +00:00
6c9d743ef4 Based on a suggestion from Zr, using line line intersection for single axis projection.
This makes perspective handling a bit better.
2005-08-25 18:03:19 +00:00
e12e2469c8 Bretch's patch for 2D transform. Thanks
Using new transform code to handle UV window.

With the ground work done, Transform could more easily be extended to handle IPO window now.

Tracker item: http://projects.blender.org/tracker/?func=detail&atid=127&aid=2946&group_id=9
2005-08-23 18:13:30 +00:00
a2eefbd7c7 Fixed some warning shenanigans 2005-07-30 01:44:15 +00:00
1d27a7676b GCC 4 didn't like static function after non static prototype. Moved prototype to c file and added static to it. 2005-07-24 09:21:31 +00:00
0e2302bfa5 Big Transform Manipulator Merge
*NOTE*: Some UI decision done in this commit will most likely be revised, all flame shall go in /dev/null. Constructive discussions of course welcomed.

This commit merges manipulator orientation selection back in "traditional" transform.
That's how it works:
	- The dropdown in the 3D view header is always visible
	- The orientation chosen will be used when choosing an axis with MMB and for the *second* key press of X,Y,Z
		However, Local orientation doesn't use the one calculated by the manipulator. This is to ensure that multiple object local and armatures in pose still works as before.
	- Alt-Space (to change the orientation) works during transform


New Transform orientation: View, using the view axis.

Fixes for the following bugs:
	- Constraint projection code "jammed" if input vector was <0,0,0>, reported a couple of times on IRC. Thanks to Basse for the example file.
	- Transform on texspace crashed on objects without texspace data (camera, lamp, ...). This was reported in tracker.
	- Numinput with lock constraints didn't work correctly. Reported on elysiun

	Probably some others that I'm forgetting

I also moved a couple of functions around in an attempt to make things clearer.
2005-07-24 06:25:00 +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
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
a344dca9cf Transform stuff
Cleanup in transform.c: removed uneeded includes and removed REPEAT experiment.

Split off manipulator init function, no need to resort on hacks to setup stuff before starting transform anymore.

Fix0r3d single axis projection for constraints. It deals with perspective correctly now (as much as planar constraints).
2005-06-28 07:58:16 +00:00
c00adc5ff8 Transform 2D center was using short. Not good enough when it's it's way off screen. Switched to ints, that fixed the bug in the tracker.
Switching to floats would probably be safer in the long term, but too many things to test to do that now.
2005-06-05 13:50:21 +00:00
90d7da7b27 Tinsy cleanup of combo drawing Manipulators:
- translate+scale : arrow at end of axis
- translate+rotate: draws axis lines now
- while translate: draws the axis line too

And: GCC was nagging about Martin's precious code!
transform_constraints.c:745: warning: suggest parentheses around comparison
in operand of &

Apparently the if(a & b == c) is undefined? Whatever!
2005-05-29 11:20:49 +00:00
14a3166685 Push/Pull didn't do Lock Constraint correctly. Fixed.
Also added an isLockConstraint function that tells if the current constraint is a locking constraint or not.
2005-05-29 09:21:34 +00:00
78a395d3d5 Fix MMB code again. (I'm near the "set an accronym for that so it's shorter to time next time" phase...)
This time, probably for good since I've really tested it through and the z factor used there never gives overflow and is correctly calibrated with both the real zfac and the zoom level.
2005-05-19 04:33:38 +00:00
1b3498b3f3 Fixing MMB selection code for good.
zfac needed to be inverted to be used properly. Works for extreme close ups and extreme zoom out.
2005-05-18 06:13:50 +00:00
7373dcf705 Transform MMB code fixing Ton's last fix.
His fix was good, except that it switched to project_float instead of project_short, and that's not good because we're renormalizing the vector after that, which maximizes the float errors. Since it's scalling the axis anyway with the zfac method, it can use project_short safely (I tested it with the bug tracker file that triggered the fix in the first place).
2005-05-16 08:25:49 +00:00
49dbf781de Three fixes in 1 commit. :)
- Bug #2530
  The MMB Transform constraint 'chooser' used projection code that didnt
  work when zoomed in extreme. Needed a correction to scale projected
  coordinate according zoomlevel.

- NKEY panel for objects: click on left/right side of scale button now
  goes with increments of 0.1 (was 1.0)

- Moving window edges in Screen: prevented top header from becoming too
  small due to grid-snapping. Was visible now with using Texture Font.
2005-05-13 09:22:37 +00:00
d07dccc386 Found some time do sanitize the big Transform call:
- Splited off the event treatment into a fonction of its own
- Splited off the initialisation phase into a function of its own (will have to do it for the manipulator function too)
	Calling transform now works like this:
		initTransform(mode, context)
		- possible post init calls, constraints mostly
		Transform()
		- eventually, the postTransform function, so that Transform is just a simple big loop which could in the end just be tied in the blender event system instead.
- Added a state variable in TransInfo to replace the ret_val local variable. Possible values are: TRANS_RUNNING, TRANS_CANCEL, TRANS_CONFIRM
- Tied MMB and the hotkey select for constraint together, so selecting an axis with MMB and pressing the axis key after that goes to local mode on that axis. Much less confusing.
2005-05-10 04:21:11 +00:00
3676fb1b3f Fixed rotating, didn't take parent into account properly (hmmm, I'm sure this worked before).
That was bug #2516: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2516&group_id=9

Also turned back some changes Ton did to drawing object constraint lines. Explained the why in a longish comment.
2005-05-09 23:37:35 +00:00
d10862a9da Fix for negative scaling & Mirror menu in Object mode (CTRL+M)
Hope Martin likes this simple hack. :)

Also; added flag in constraint to denote whether its local or not. That
way its possible to:

- prevent local scale and rotate on multiple objects to change own position
- draw constraint lines cleaner
2005-05-07 21:04:55 +00:00
61f2736ec3 Local axis constraint external call. Had to do it in a very hackish way which highlight a design problem in the code. To solve it (and would solve other problems too), we'd have to split off the initialisation function. Not terribly hard to do but I'm overwhelmed with work...
Push/Pull had a problem with constraints enabling/disabling. Fixed

Restablished infinite line for constraint draw (when not using manipulator) as discussed in meeting.
2005-05-02 02:18:13 +00:00
6379ff9b70 Toying a bit with MMB behavior:
MMB click with no constraint selects a constraint right away (the axis selector doesn't flash on screen)
MMB click with a constraint removes the constraint
MMB click-drag in both case (with and without a constraint) uses the axis selector.

stopConstraint didn't remove the CON_SELECT flag, so cancelling transform while selecting a constraint and then reentering transform was funny. Fixed
2005-04-24 01:18:13 +00:00
c1a7b8b7a1 Local axis constraints for pose mode. Added
Camera rotation fix (was off centered because it used persinv instead of viewinv. Now rotation center is always center screen in camera mode. (Still need to fix the helpline not showing)
Numinput constraint function was no good, didn't check if a constraint was even on... Fixed.
Rotation was missing constraint text in header print. Fixed.
2005-04-22 01:14:15 +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
1bde293997 Bug fix #2394
While in camera view, going to local axis rotation (R, X, X) the view
became instable. Was still using the view3d view matrix, instead of
initialized TransInfo->viewmat.

Martin; you could check on the mouse motion in this case, for some reason
it only uses horizontal motion?

ALso; renamed button in InfoWindow "Disable sound" to "Disable Game Sound".
2005-04-12 10:08:04 +00:00
4ea8947ea7 Merged all the internal transform includes into transform.h and moves it to /src to /include.
Split the conversion fonctions and sorting functions from transform.c into transform_conversions.c
Update MSVC 6.0 projectiles and SConscript accordingly.
Editview still included transform.h, replaced that for BIF_transform.h, the external include.
2005-04-10 18:33:19 +00:00
9ec8778288 SoftBody:
- on add new SoftBody, it creates automatically edges in Mesh now, gives
  too confusing results otherwise
- if no edges exist in mesh, it also doesnt add diagonals for faces in
  softbody

Transform;

- fixed stupid 'used unitialized' gcc warning (sorry theeth!)
- made dualAxisConstraint() accept string too
- little cleanup of prints in using Manipulators
2005-04-03 20:13:10 +00:00
bbcc63326e New minimal & 2D drawing type for Manipulators; try F10 "rt" on 5 (or 6 for
same style in trackball arcs)

Full collection can be found temporally here;
http://www.blender.org/bf/rt.html
2005-04-03 13:12:08 +00:00
312c8d146c Removed casting warnings from transform_manipulator.
PET is now checked as a transform flag during transform. Much cleaner that way for NOPET context (extrude, duplicate)
Added Sphere as a new PET falloff mode (icon and all) and reordered them around in a more logical fashion (IMHO).

Also brought back Subsurf toggle with Shift-O (was supposed to be for PET object mode but that was canned).
2005-04-01 18:39:39 +00:00
7532aa248f Transform fixes
Connected PET for mesh had an infinite loop in some case. Fixed an made a bit faster.
Renamed the numinput flag.
Corrected a conflict in TransInfo flags. This was a crash waiting to happen.
NO_CONSTRAINT flag now correctly used to disable MMB and constraint hotkeys when needed.


Added check for the manipulator flag when drawing them before applying transformation matrix. Was really weird when doing MMB with rotation.
2005-03-31 21:02:35 +00:00
fa37194082 Prop mode goodie;
- Made proportional edit in Mesh editmode use connectivity to clip the
  area where proportional editing is allowed.
  Uses some kind of manhattan distance for clip area still, so is slightly
  too large for diagonals. Will be worked on!

- Fix; in constraint code, using (0 0 0) delta caused NaN.
2005-03-29 17:05:43 +00:00
727a056de4 A couple of wee transform featurettes;
- center of rotation for camera in cameraview rotate has to remain the
  camera center itself, drawing the dashed helpline then doesn't work,
  since it's behind the camera clipplane. Just disabled that line.

- made MMB switch for cameraview grab to become quadratic, for a dolly
  this feels OK, and makes it possible to move in small and large scenes.

- restored SHIFT modifier for translation and scaling. This based on old
  convention that allowed precision editing on top of the transform you
  already applied before pressing SHIFT.
  Solved it with a new flag (T_SHIFT_MOD), since the G.qual cannot be
  used. Transform() innerloop has to detect the SHIFT event itself.
  Also coded it with storing the mouseposition while SHIFT event happened.
  Hope Martin can approve! :)

- Martin's last commit made Manipulator Translate not work, it passed on
  a zero translation to the constrainter, causing NaN's. Nicely catched the
  exception.

- Fixed 'Trackball' to accept number input too
2005-03-25 11:17:59 +00:00
ea15126d75 axisProjection can take care of zero-length vector so we don't need to check anymore. Was giving some problems with cameras looking perfectly down.
Also removed all NEWTRANSFORM defines, using the new code all the time now.
2005-03-25 03:28:08 +00:00
4bcf80bf4f Reworked the camera dolly/parallel axis constraint code a bit. Works pretty much like the Shrink/Fatten code, meaning pull the mouse toward you pulls the camera, push pushes it away.
Also added a T_CAMERA flag for camera grab, which gets set on TransData conversion.
2005-03-24 21:32:52 +00:00
76f2346080 Transform fixes;
- Camera translate in camera view, with MMB, works again. Code needs
  verification by Martin... it does it different now too.
- Camera rotate in camera view works again. MMB switches to 'trackball',
  as formerly. Isn't consistant with other rotate+MMB though...
- rotate camera in cameraview around cursor doesn't 'feedack' anymore

Martin; I only use the TransInfo->persinv[4][4] now, but I think it's
safe to use viewmat and viewinv too?
2005-03-24 18:47:09 +00:00
aab0b1535f Transform stuff for TEST!
- 4th rotation widget styling, activate with Scene buttons, Anim panel, "rt"
  on "4".
- drawing constraint lines replaced with widget compatible styling.
  (functionality unchanged)

Fix;
- click on center for Rotate widget didn't switch to local/normal in all
  cases
2005-03-23 11:49:54 +00:00
c2121fb855 Fix for possible divide by zero error in Rotate.
Fix for MMB behavior when two axis were exactly on one another or very close. It now defaults like this: X, Y, Z (meaning if as near as X as Y, it chooses X). This could be fixed further.
2005-03-21 19:16:39 +00:00
e5520d955c Created initConstraint. It basicly just checks if the CON_APPLY has been set up (by the BIF_setConstraint calls for example) and calls startConstraint. This must be done because startConstraint uses data initialised when starting transform so it needs to be called after that.
Also changed some strcpy into strncpy.
2005-03-21 18:25:17 +00:00
bc77092959 Added string to BIF_setSingleAxisConstraint() function for headerprint.
Needed for martin to further work on print stuff
2005-03-21 17:52:45 +00:00
630bb7f7bf Warp was acting weird if the cursor wasn't centered in the data space, that is fixed.
Helpline for warp was wrong in edit mode if the object wasn't centered on global space.
Boundbox calculation for warp is done in view space now, so it is always maximised since aligned with the view.

Switch the negative/positive switch for Shrink/Fatten from horizontal motion to vertical motion. Pull down to shrink, pull up to fatten. This could still use some work.

BugFix: Constraint center was wrong with MMB (was bypassing the fix I commited the other day).
BugFix: Changing modes while in transform and switching to local constraints in edit mode crashed. This was due to resetting the TransInfo flag in initTransModeFlags. Now done correctly in initTrans.
2005-03-21 00:39:09 +00:00
e65b0beea8 Ton broke a couple of things in his last commit including PET in rotation mode and local axis constraints on objects.
Bringing that back and enabling PET in trackball rotate.

Changed the rotation manipulator drawing code to really align the Trackball rotate ball with the view (using getViewVector) so that it always looks centered on the selection.
This was particularly ugly in perspective mode with a selection far from the center of the screen: http://www.clubinfo.bdeb.qc.ca/~theeth/screenie.jpg

Moved getViewVector from transform_constraints.c to transform_generics.c since it is not really a constraint related function. Also made it independant on the TransInfo structure so it might be useful elsewhere too.
2005-03-20 02:00:16 +00:00
8e92ee8684 - remove all obsolete inclusions of BLI_winstuff.h (due to recent changes)
NOTE: BLI_winstuff.h was meant to be a wrapper around windows.h to handle
undefining various crap that windows.h defines. Platform specific headers
should only have to be included in a few places. This reduces the number
of inclusions of BLI_winstuff.h to 16 which is a much more reasonable
number (than the 144 or whatever it used to be)
2005-03-19 21:08:13 +00:00