Commit Graph

143 Commits

Author SHA1 Message Date
bdb12f23cf Bugfix #4843 revisited
This is a new incarnation of compatible_eul(), a function called:

void Mat3ToCompatibleEul(float mat[][3], float *eul, float *oldrot)

It uses the two euler extraction methods as added by Brecht a while ago,
and checks for compatibility each, and then picks the best of the two
based on minimal difference with 'oldrot'.

Gives for rotation key inserting a much higher hitrate for OK eulers.
2006-08-13 10:03:07 +00:00
d3028ec70d * Shrink/Fatten for bevelled curves
This is a much faster and easier way to give a bevelled curve a taper, without
using taper curves. Each point on a curve now has a 'radius' value that you can
shrink and fatten using Alt S, which will influence the taper when the curve is
bevelled (either with a bevob, or with front/back turned off and a bevel dept
set). Alt S shrinks and fattens the selected points in an interactive transform,
and you can set an absolute radius for selected points with 'Set Radius' in the
curve specials menu.

See demo: http://mke3.net/blender/etc/curve_shrinkfatten-h264.mov

This can be a quick way to create revolved surfaces (eg.
http://mke3.net/blender/etc/wineglass-h264.mov ) and it would be very
interesting to use this radius value in other tools, such as a 'freehand curve'
tool that would let you draw a curve freehand, with the radius affected by pen
pressure, or even using the radius at each point to control curve guides for
particles more precisely, rather than the continous maxdist.
2006-08-13 07:37:51 +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
Ken Hughes
cf266ea2af Bugfix #4627: headerResize() was overflowing a string parameter and
destroying part of the transform matrix.  Also remove a debigging printf.
2006-07-08 14:24:57 +00:00
Ken Hughes
bdafdaa171 Bugfix #4590: typing in large translation values caused string buffer overflow. 2006-07-04 16:53:11 +00:00
Chris Want
ed00ef33c4 Changed some references to 'size' to now refer to 'scale'. If anybody
sees a reference to size, as it pertains to a 3D object, please let
me know.
2006-06-15 04:13:26 +00:00
b58998729b Last minute patch from Chris Want
Nkey "Properties Panel" now has Dimension ("Dim") buttons too.
This reads from the actual bounding box value to see the size. Note that
dimensions for animated & deformed objects will change per frame.

(Cleaned up buttons layout for patch, and added support for Curve, Text and
Surface objects)
2006-06-12 20:01:18 +00:00
2c7712dd84 Fix #4245
Old annoyance in Blender; zooming in very far makes scaling/rotate
around invisible pivot going bezerk. The easy fix was just enforcing
floats in integer math.
2006-05-29 13:01:51 +00:00
ee2baaf3e3 === Transform ===
Bug #3657

Texture Space transform
* grab/size: did not support local constraints properly
* size: constraint support did not respect object orientation
2006-05-14 17:02:56 +00:00
07b88496e0 === Transform Display ===
Based on a patch by Matthias Derer, this adds the distance moved to a translation (grab) transform
(both 3D and 2D, although the 2D transform displays the normalised distance only).
2006-03-26 22:35:03 +00:00
2db9b8fe7f Quick feature: "Around Individual Centers" now works in editmode mesh, but
only in Face-Select mode. It then uses for rotate and scaling the face
center itself as reference.

Code uses a loop-in-loop to find the face that belongs to the vertex...
means it will be slow with operations on 10k or more faces. Acceptable
for now, will make it nicer later. :)
2006-03-08 11:07:49 +00:00
94332c522e Bug #2839: Shift key not working in Shear, Push-Pull and shrink-Fatten
- I changed the input method for shear quite a bit. It used to be constant
  regardless of zooming, so it was quite limiting in the amount of shear you
  could do. However, I'm not sure if the current method is quite well
  adjusted, if you think it works too fast, please drop me a line.
  It's basicly the same method as Shrink-Fatten / Push-Pull except on an
  horizontal basis. (since shear is an horizontal motion and the two others
  are more like pulling towards/pushing away from you in regards to the center)
- Factored out the input methods in preparation for later code <evil>.
2006-02-12 21:09:18 +00:00
a96bf9283a Move bug fix hack so it acts only when it needs too.
It was showing "global axis" even when using MMB to access user defined orientation (with Ctrl).
2005-12-19 16:32:18 +00:00
5884082ef6 #3581
Using the MMB constraint chooser in Transform, accidentally printed the
setting from the orientation menu (Local, View, Normal).
Martin: not sure if this a solid fix... the print now looks fine, but the
code isn't nicer this way. :) (just a one liner change though!).
2005-12-19 10:49:37 +00:00
ddba16a752 Bugfix #3422
When using 'protection flags' for XYZ rotations, inserting keys in
Poses resulted in wrong interpolations (doing -270 degrees instead of
+90 for example). This caused by converting quaternion to euler and
back...
Solved it by correcting the quaternion in the end for the rotation
sign of the original quaternion.

NOTE: Pose animators should be aware that inserting rotations keys of
180 degrees or larger will still make the key rotate along the shortest
path.
2005-11-21 10:45:58 +00:00
8a0befc3fd Bug #3338
While using automatic IK, a pending redraw event could draw the buttons
window again, reveiling the temporal IK buttons. Using them, after grab,
caused a crash.

Also: noticed that the undo push for transform is called too early, so it
saves the state before 'special_after_trans' was called.
Also: in editmode armature, changed shift+A "Bones" in "Bone".
2005-11-03 21:13:20 +00:00
4ad59e30a0 New: Write Protection for transform values.
You now can set, in NKEY Transform Properties Panel, per XYZ rot/loc/size,
a protection for Transform tools to not change these values anymore.
This now works for Objects or for Bones in PoseMode.

Usage is especially for character animation, to give Bones in a Pose
defaults for rotation axes, so you don't have to worry about the correct
limitations (or setup complex IK limits).
Of course, this feature doesn't influence the animation system.

As an extra also the Transform Widgets then draw less handles. Note this
is based on the actual locked value, and depends still on Manipulator
orientation whether it can be used really.

Implementation warning: I had to remove the 'return' in the middle of the
editobject.c compatible_eul() call. It now makes nice compatible eulers
when they're simple (single axis rotations). Unfortunately there was no
note in the code why it was ever removed...

ALso: fix for crash in using Crease Transform and Mirror modifier.
2005-10-29 20:08:25 +00:00
42fe4c568d Transform MMB behavior correction, as mentionned in meeting.
MMB uses global axis, Ctrl-MMB uses user defined. (Alt-MMB cause conflict with the window manager on linux)

(for hotkeys, first press is global, second press is user defined)
2005-10-02 19:31:32 +00:00
90b5c5054c Fixing bones grab in "pose" transform. Bug #3030: http://projects.blender.org/tracker/?func=detail&atid=125&aid=3030&group_id=9
It didn't do initgrabz correctly.
2005-10-02 18:27:14 +00:00
6e94b02616 Various Transform bugfixes.
- Trackball rotate was missing the NoConstraints flag
- Zooming didn't recalculate the 2D center correctly
- Zooming in transform was sending event to the 3D window even when working on UVs. (disabled when working on UVs for now, will need to send events to a 2D window handler eventually)
- In camera mode, when the selection was exactly on the camera, initgrabz was barfing, fallback to 1.0 now, which gives ok results.
2005-09-24 18:00:32 +00:00
abb66762f1 Bugfix #3089
PoseMode rotate now also supports "Around individual Centers" for rotating.
2005-09-22 20:11:21 +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
dd5410162a New feature; User definable Clipping Planes.
Press ALT+B in 3d window, draw a rect, and it becomes a clipping
volume of 4 planes. You then can rotate the view anyway you like.
Works for each 3d window individually.

Disable it with another ALT+B press.

Commit is huge because it had to change all selection code as well.
The user-clipping planes are in 'eye space', the other clipping
happens in projected 'viewport space'.

Nice to notice is that the 'x=3200' convention (to denote a coordinate
is clipped) now is a define. Define value is still a number though... but
we now can get up to screens of 12000 pixels without issues!

Known issue; here it refuses to draw the 'object centers' or Lamp icons
within the clipping region. Can't find any reason for it... however, we
might move to non-pixmaps for it anyway.

Testing might reveil numerous issues, will be standby for it.

Curious? Check this http://www.blender.org/bf/rt4.jpg
2005-08-20 19:18:35 +00:00
9e05d6efb5 Armature "Envelope" editing.
For defining the deformation distances of Bones, three values are being
used now. The bone tip and root radius define the bone-shape itself and the
"dist" defines the soft area around it. A full (user) doc is in CMS here;

http://www.blender3d.org/cms/Armature_Envelopes.647.0.html

Note: todo still is allowing both Vertex Deform Groups and these Envelopes
together (and or per Bone).

Also part of this commit is:

- New: Hiding bones in EditMode. This is a separate 'hide flag', so you can
  keep the PoseMode hidden Bones separate from EditMode.
  (In the future we should do some kind of bone-grouping or so)
- While transform(), the hotkeys G,R,S only switch mode when the previous
  mode was compatible. Caused conflicts with Crease/BoneDist/etc.
- Deleting the last VertexGroup now also deletes the entire Mesh 'dvert'
  data. Sounds logical, but remember that VertexGroups are partial on a
  Mesh, partial on Object. Weird design decision though...
  Anyhoo, at this moment the only way to have Bone Envelopes deform, is
  by deleting all VertexGroups!
- In PoseMode, the hotkey ALT+S now does both B-Bone size or Envelope,
  depending draw type.
- In EditMode, Extrude now also works when only Root points were selected.
- Weight editing is also symmetrical btw, with the "X-axis Mirror" option
  set.
2005-08-19 12:35:15 +00:00
392e4b89f5 Tweak mode
RMB click drag to select and transform (grab). Release to confirm. (Cancel with esc)

The difference with before is that it is a single motion, you don't have to click at the end of transform, you can just release the mouse button.

(Some float constant warning too)
2005-08-16 18:23:28 +00:00
7c539f8ebc ToSphere changes.
- Scale goes from 0 (original) to 1 (full sphere) instead of the contrary
- Mouse control is done by moving pointer left / right on screen. Full right is 1, left is 0. There's a 10% width padding on each border.
- Works correctly with Shift modifier now.
2005-08-16 17:37:42 +00:00
b45ecb43ef New! When weight-painting a Mesh, and select a Bone, you can use transform
options on the Bone (G, R, S). The manipulator doesn't show btw.
Is usful to get immediate feedback on how painted weights behave with Bones.

Martin; I had to change the T_POSE behaviour in code a bit... it now
stores in TransInfo the actual posed armature being transformed. Maybe,
some day, we'll get mixed posechannel/object transform? Not much required
at the moment though. :)
2005-08-16 10:17:02 +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
948f27c0d8 Killed silly modal PoseMode mode! :)
- PoseMode now is a state Armature Objects can be in. So, while in PoseMode
  for an Armature, you can just select another Object or Armature.
- The old PoseMode options (transform, insert keys etc) are accessible
  with making the Armature Object 'active' (and have object in PoseMode).
- At this moment no multiple Poses can be transformed/edited at the same
  time.
- The old hotkey CTRL+TAB, and view3d header menu, still work to set an
  Object's PoseMode

It was quite a lot recode, so tests & reports are welcome.

Oh, as a bonus I added Lasso Select for Bones in PoseMode! It selects using
only the line between root and tip of the Bone.
2005-07-23 18:52:31 +00:00
e700b79587 Removed last remainder of old transform. The function is still called
special_aftertrans_update() though...
2005-07-19 11:21:01 +00:00
fdaf1c6eac Three fixes, thanks to irc reporting of Basse & Sten;
- Bone points for B-Bone drawing were not adjusted for size of Bone, now
  they draw same size as for other bone type
- Deleting bones in editmode didn't check for constraints in Pose, causing
  weird collapsed poses or even crashes
- ALT+S scaling on B-Bones in editmode didn't correct for the Object scale.
2005-07-17 17:36:54 +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
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
9c63b95d34 Follow up on the Numinput / PET conflict bugfix.
Added Page Up and Page Down as hotkey to increase and decrease PET area of effect.
2005-06-11 02:17:25 +00:00
1dd02d4cf9 As discussed in meeting, fixing Numinput annoyance in transform.
Numpad Minus can now be used all the time to type negative numbers, without interfering with PET.

WARNING Behavior change: PET area of effect is not resized with Alt-Num+ and Alt-Num- (in addition to the scrollwheel)

WARNING testing needed: it's late and the laptop here has a funny emulated numpad, so better be tested on a real keyboard by someone who is not coding past midnight.
2005-06-05 14:26:45 +00:00
f99b6a3042 Float precision error could cause RKEY to start with 0.02 degree rotation.
This because the used integer+float division could result in a
9.999999e-01 value, which is for acos() to return 3.452670e-04.

Converted the division to use doubles instead.
2005-06-05 12:24:35 +00:00
f38e0686d9 new round of warning fixes. we are now down to 24 with Xcode on blender
alone with the following flags :
-Wall -Wno-char-subscripts -Wno-missing-braces.

the only one still worrying me is in rand.c line 57 :

rand.c:57: integer constant is too large for "long" type

but i have no clue about how correct cross-compiler and 32/64 bits friendly

see also my mail to commiter list for signed/unsigned issues
2005-06-04 16:22:50 +00:00
1d7a8cf86f Two more fixes in Transform:
- Ipokeys didnt have 'selected' flag, so were not included in center
  calculus
- Multiple keys transform didn't apply this center even...

ALso took extra work time to add credits in splash. Frédéric Van der Essen!
2005-05-29 23:21:56 +00:00
0bd69e6616 Crash Fix: Mirror Tool crashed when there was no selection (stupid lack of check). 2005-05-29 09:57:51 +00:00
fad9e3b979 Behavior consistency: Make Push-Pull and Shrink-Fatten work in the same way regarding what happens when you move the mouse toward or away from you. 2005-05-29 09:50:10 +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
910b0f2cda Local constraint uses center mode again. This fixes a bug in the tracker, wasn't really a "bug", but anyway... 2005-05-22 12:01:12 +00:00
7f4ff24462 Unitialized variable in resize function.
Was caused by a previous commit, disabling Element Center mode for edit mode, since it's not working properly yet.

Fixing bug #2558: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2558&group_id=9
2005-05-16 23:23:19 +00:00
70c0f60df5 Fixing bug #2556: http://projects.blender.org/tracker/?func=detail&atid=125&aid=2556&group_id=9
MEMSET was clearing the TransInfo struct after the constraint setup call has been made.

Temporary fix until the manipulator transform init is split off, like normal transform.
2005-05-15 05:44:11 +00:00
a7bbf8245a Fixed various errors with Blender allowing editing Library linked data.
CTRL+V on buttons
NKEY Panels
join mesh
join curve
editing buttons
boolean
vpaint
faceselect
Manipulator

Also; Transform() got in useless loop when you entered without anything
selected. Not sure why Martin recoded it this way... maybe as a first
step to handlerify it? For evil Python Aussie Bosses? :P
2005-05-12 19:17:12 +00:00
e3c11a0bcc Bugfix #2541
Using as Pivot the "individual object centers" didn't do any rotation or
scaling in editmode. I think it was supposed to give some kind of
'connected' centers, for individual faces/edges rotate. That'll be some
more coding work to get to work. :)
2005-05-12 17:11:32 +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
eec4e32714 Another Transform todo: correct Undo names for using Transform.
Martin; I've added calls like:
	BIF_TransformSetUndo("Add Duplicate");
In advance of calling transform itself, to indicate that this is the
string name to be used for Undo, and also has to be done on ESC.
To make that possible I had to add a memset() to zero the global struct
TransInfo. Nicely done with if(Trans.mode==TRANS_INIT)

Not sure how this relates to setting constraints in advance... I always
found it tricky to work a non-initalized global struct. :)
2005-05-08 12:00:28 +00:00