Commit Graph

143 Commits

Author SHA1 Message Date
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
c2140d28c1 - Fixed flipped orientation of getViewViewvector(), was opposite in ortho
versus perspective.
  Note for Martin; still an issue with defining what positive/negative
  rotation is in perspective... needs more math here!
- Added Transform Widgets for PoseMode
- made adding bones in EditMode setting G.moving, so it doesn't draw other
  selected objects nor Widgets

Warning in commit of Martin yesterday: Trackball and initTrackball were
declared static, whilst also in transform.h. Quez; why are these functions
exported in the .h file?
2005-03-20 09:45:54 +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
52417aeb6e - added helper lines in rotation widget
- switched to Local mode for widgets by default, will be a key/button later
2005-03-19 22:03:14 +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
35ab8a32a1 Global G.moving got nice define flags, and additional meaning.
- move object mode
- move editmode/pose mode
- move with widgets
2005-03-19 20:27:13 +00:00
a2ed880c9f Transform widgets; Scale and Rotate versions
To use; press the (temporal) icon in header. Switching widget types is by
pressing G, R or S once, if current widget type is different it switches,
otherwise it goes to normal Transform().

Widgets need a bit test for picking accuracy, correct drawing etc.
The rotate widget has a center button for 'trackball' rotate. That latter
can also be used for hotkey-based rotate.

In current code, all widgets remain in "Global" space, also in editmode.
Also widget updates while using normal transform has to be done.

2 Bugfixes:
- rotate in PoseMode had error for 2d 'around' center
- transform in postemode could crash, due to typo (& or |)
2005-03-19 12:17:06 +00:00
f08504c525 Individual Element (object) center for Rotate and Resize. Note that using this in edit mode is a bit useless right now, but we have some surprises in our bozo bin :P
Transform can switch mode on the fly again (GRS).

Fixed a bug with the BIF constraint call, needed to call startConstraint and normalise the space matrix (this affected the manipulator).
2005-03-18 15:08:02 +00:00
17bd00a851 So! Finally a show-off of the *power* of Martin P's work! :)
- Made framework for 3d Transform Manipulators (widgets)
- The Manipulators act like '2d buttons', by default with LeftMouse and with
  while-hold-move-release
- Implemented now: Translation Widget, which allows:
  - four hotspots for axis grab or view-aligned grab
  - center defined by 'around' setting
  - SHIFT+LMB gives planar constraint on other 2 axes
  - works in Object mode and Edit mode (not posemode yet)

Enable it with (temporal) icon in 3D header. All other 'normal' transforms
then keeps working btw.

On the todo for this widget:
- choice for Global, Local or Normal orientation

The way the widgets are going to work is in review still. Commit is also for
Matt for his proposal/paper on topic.
Some notes regarding this project;

- no life updates (on mouse over) like 3DS, I think that's neurotic
- on click, dominant axis changes to theme defined "Transform" color, other axes disappear, like maya
- manipulater size is fixed preset, independent zoom.
- manipulator follows selection, and is located based on 'around' mode

Unresolved;

- in maya, when you select 2 or more objects, the manipulator draws on the 'active' object, also interesting
- what to do with G,R,S hotkeys? It could switch the manipulator "mode"...
- header button/menu for manipulator mode?
2005-03-17 21:31:49 +00:00
38dff43877 Needed to normalise the axis orientation matrix.
This fixed the scaling bug intrr and LetterRip reported.
2005-03-17 13:55:48 +00:00
07c26eb397 Fixed constraint center calculation. Much smarter to do it when calculating transformation center...
Fixed Extrude constraint. Needed to premul the normal by the object's matrix to but it in global space.

Also, moved the Locking Axis modifier (for constraints) from Alt to Shift. Alt was conflicting with middle mouse button emulation (reported in the test builds forum).

Tilt Transformation.
2005-03-16 21:55:57 +00:00
1b61771d9e Optimising transformations in PET mode.
Sorting elements in TransData array according to their distance. That means we can always stop loops when it finds the first element that doesn't apply. That makes PET factor calculation and actual transformations faster since it stops at the first element outside of the area.

The Sorting algo is a no swap version of quicksort using the start of each subset as the pivot (random would be better and easy to implement. Need 3 additional lines of code really).
2005-03-15 17:31:46 +00:00
3ca88c4e7f ome more warnings cleaning 2005-03-14 20:10:22 +00:00
60b0e67e32 Fixed edit mode armature bug reported by Gabio (transdata conversion wasn't setting data center correctly).
Brought back Shrink/Fatten. Changed the behavior a bit, move the cursor to the right to move toward the normal, to the left to move backward. Please comment.
Only works with meshes, defaults to resize otherwise.
2005-03-13 20:17:39 +00:00
e76a63635b Transform:
Camera grab from camera mode works, but not the middlemouse-toggle, that
has to become a new "Dolly" constraint coded by Martin P! :)
2005-03-13 19:48:17 +00:00
7d520a16c4 Made warp use TransData members instead of G.obedit. Made it work with PET and Objects at the same time. 2005-03-13 02:15:32 +00:00
597cbb1b4f Local axis with multiple objects wasn't working for Scaling.
Also, splitted of Translation's applying loop (for eventually macro interface).
2005-03-12 23:15:26 +00:00
8f47841536 NumInput is now applied correctly to constraints and prints correctly in the header.
What that means is that you can grab/resize an object, press Xkey, type 2 (to resize/move by 2 on the x axis) and then press Ykey and the numeric value will be applied to the transformation on the Y axis.

Fixed a small glitch where constraint center wasn't readjusted for edit mode when using MMB (graphical bug only).
2005-03-12 20:34:02 +00:00
8129e55940 It's fun to set flags correctly and not have everything crash down on you. 2005-03-11 18:48:14 +00:00
3bc2ae130d IMPORTANT NOTE: Locking axis (planar constraints) now works with ALT instead of CTRL. Ctrl might have caused problems in the long run, with people holding down ctrl for precision and then having to release it so to press an axis key if they don't want to lock it.
Finish adding local constraints for multiple objects: One of the objects will have its axis highlighted lighter than the others. You control this one with your mouse and the others copy the motion on their respective axis.

Code changes: the TD_OBJECT flag is now a flag in TransInfo with the new T_POSE, T_EDIT and T_TEXTURE
2005-03-11 01:33:43 +00:00
c78e44cdc5 big warning hunt commit
lot of casts, added prototypes, missing includes and some true errors
2005-03-09 19:45:59 +00:00
77d44e88e9 Transform project; restored "auto key" after transform. It now inserts
always loc/rot/size ipos. The old method had a quite questionable
heuristic for detecting what changed, not sure if we want it back.

Added note in code, good candidate for later recode with dep graphs.
2005-03-09 19:32:23 +00:00
3e5200f1db - Restored 'align mode', which allows rotate/scale with only object centers
- commented out debug prints from theeth :)
2005-03-09 16:58:42 +00:00
8eef3cfd9c New transform project;
- restored 'Warp' (Shift+W). Should work like before, including type mode
  and holding ctrl/shift modifiers
- added CTRL event in queue, to only redraw when you press it. looks nicer.
2005-03-08 17:29:33 +00:00
81ea38cd10 + Local axis constraint for multiple object selection works with resize and rotate (the easiest).
+ Refined the headerprint for Translation. Now prints only the needed info for constraint in the constraint's space (ie: if you're moving 1 unit along the local X axis, regardless of it's orientation, it will print "D: 1.000 along local X")
Still need to make numinput work like that (typing a number with a local axis constraint would move along that axis. There's some base code already though, just need a finishing touch, but it's late now)

+ Optimised PET calculations by using the TD_NOACTION flag (actually, that might have been in the last commit).

+ Added a float axismtx[3][3] member to TransData to store the orientation of the element (useful for local axis constrainst which, in edit could be moving along normals and the like).

- Fixed scaling in edit mode (was doing some matrix multiplications in the wrong order, only visible when using a constraint)

- Fixed the constraint projection matrix. It didn't work for planar constraint if the constraint space wasn't global (in a nutshell, it produced weird results for local space planes).

- Some potential bugs fixed (Note to Ton: added an ext pointer in TransInfo to point to the TransDataExtension block. With the sort done after allocation, the first td pointer doesn't necesarely point at the start of the ext block, so we needed another to free it correctly).

- Got rid of some remaining test with G.obedit.

- Moved constraint reset from init to post trans code (Ton, that means you can create constraints before calling transform, like for the menus for example).

NOTE:

I was getting some random segfault with the new headerprint code. Very random, couldn't reproduce with a debug version. I did some initialisation that might have been missing (though doubtful that's what caused the crashes). Was linked to using constraint though not caused by them. Probably due to some dumb late coding error.
2005-03-08 03:51:45 +00:00
7b081fe3b7 Local axis constraint started.
Works with edit data and in object mode with single selections (only one object selected).

Also started adding constraint stuff in headerprints. Only for Translation for now.

Pressing X,Y,Z (and the Ctrl versions) toggle between global, local and off like it used to do.
2005-03-07 02:21:04 +00:00
b6cb442c2a Fix & further implementation of Proportional editing;
- made generic 'calc distance' function for it
- added generic call to sort TransData with selection first, for speedup
  of propmode calculus
- removed most propmode exceptions from code, only used for counting now
- all editmode transdata conversion function structured identical
2005-03-06 19:25:58 +00:00
f458405069 Fixed resize constraining. Was using same function as translation but this is no go for unaligned axis.
Made a generic snapGrid function. Now, each transform needs to define it's snapping parameters in their init. This is needed because of the constraint branching.
2005-03-04 00:07:16 +00:00
58b3022b52 Fixed a bug in the constraint projection code. It only worked correctly when locking the Z axis because of a malformed if clause.
Renamed the constraints defines to CON_*

Renamed the fonctions used to interactively select a constraint (with MMB). The previous naming scheme was obscure at best.

Added a CON_SELECT flag when selecting interactively. (Following the idea of the patch joeedh submitted).
New behavior when selecting a constraint interactively, not only does it highlight the axis that will be selected, it also makes it the current constraint.

Holding down Ctrl when selecting a constraint with MMB now does the same as hitting Ctrl-AXIS. That is, it locks that axis (planar constraint on the normal plane).

- - - - -

To all those who posted suggestions, I'm not forgetting them:
- broken / desoto with the plane draw thingy,
- RobertT's push/pull transformation (that was from before the new code even)
- UnNamed's MMB interactive idea as we discussed on IRC
and all the others that I've noted down somewhere.

Next for today, I'll have a look at local constraint (object's axis).
2005-03-01 19:22:29 +00:00
cfd5439bc6 Fixed Constraint projection code in perspective mode. When using a planar constraints, it follows the movement of the mouse exactly instead of just casting on the plane.
In user terms: the motion on screen of the selection follows the motion of the mouse pointer.

Gives some errors when the constraint plane is nearly perpendicular to the view port though.

Added a debug print function for 4D vectors to arithb.c

Optimised the 3D -> view projection functions in view.c (a bit).
2005-02-27 19:14:21 +00:00
76500cd1ed Transform; correct inverse parent implementation for translating children 2005-02-25 19:01:13 +00:00
b334be110d New transform:
- added texture space grab/scale (TKEY objectmode)
- made new transform work with menus (meaning, dropping dreaded while-hold)

To Martin & other while-hold lovers: this needs to be carefully thought over
and designed. I prefer to look on this within context of making transform
fully tablet/pen friendly, as option. Aim now for me is still: get transform
back to work! :)
2005-02-25 17:40:03 +00:00
4ee71094fa Added the "initgrabz()" call in new transform, this is needed to calculate
correct mapping of mouse motion to a 3d vector in perspective mode, e.g.
corrected for depth.
2005-02-25 11:55:03 +00:00
91fbe72115 Transform project.
Brought back functionality to work with "Ipo Keys" (Kkey in 3d window). New
transform code is looking more messy now... its design was not purposed to
clean on this level. Acceptable for this stage however.

Also renamed old variables *tob into *td.
2005-02-25 11:35:24 +00:00
386f390ab8 - Transform works for Posemode again (after split of TransData in 2 parts)
- error in scaling objects fixed (it accumulated scaling)
2005-02-23 14:19:41 +00:00
9f678340b5 Fixed some bugs with Shear and Resize, was acting weird in object mode when parenting was involved.
Changed the meaning of mtx and smtx for objects. It's now uniform accross the board.

Added TD_OBJECT as a TransData flag. Objects is requiring exception code here and there, use a flag instead of G.obedit. Will document what the exceptions are for people who wants to add more transformations.

Split TransData in two.

Note to Ton:
You'll have to change posemode to use the new structure. I've left some variables as part of TransData to have a compilable version in CVS, remove them when you stop using them.
Check MetaElement and Object conversion for example on how to use TransDataExtension (though I'm sure you can figure it out by yourself).

And that's it. Not much coding time in the week days. :\
2005-02-23 02:23:50 +00:00
118e4bcf7b Transform project. Daily update:
- Pose Mode restored
- Dependencies work again as usual (mainly copied old code)
  so grabbing a Hook deforms, etc
- Made main transform loop idling nicely (save CPU)
- removed proportional mode for Objects (Martin OK'ed)
- code style: renamed "tv" into "td" variable names (trans-data now)

TODO:
- Ipo Key-mode editing
- texture space grab/scale
- correct inverse for scaling children offset
- actually, loadsa testing needed. :)
2005-02-22 16:50:04 +00:00
7ad68dd4a6 Daily commit for transform() project, to prevent conflicts with Martin's
work. :)

- added static and (void) and some style stuff  in transform.c
- first additions in code for posemode (do not even try now!)
- fixed warnings in previous commit martin (gcc only)

Note; posemode old transform had complex dependencies on redraw (Hos' home
grown dep graph), which is first being restored. Including old style
set_base_flags_for_editing. Tomorrow!
2005-02-20 19:00:00 +00:00
4e39c4361f Making transform's code more Blenderish with a proper extern include file (BIF_transform.h) and extern function calls (BIF_*).
On a side note, Shear was fixed in last commit, just forgot to mention it. It wasn't acting correctly in Edit Mode (and Desoto was poking me about it every sunday).
2005-02-20 01:25:10 +00:00
dcb41bfdcd Actually done in previous commit; removed dreadful warp-pointer :) 2005-02-19 16:44:17 +00:00
09f21e45d7 First commit for the transform coding for me!
- fixed warnings in compile (transform.h struct defines)
- drawPropCircle was on wrong location in editmode
- removed prop circle drawing for old transform (sorry, but we're going to
  move soon anyway!)
- removed spaces from transform.c
2005-02-19 16:37:48 +00:00
f24c823f77 Little test commit for slikdigit.
Moves mouse pointer to center of transformation on grabs init. Easier to select a constraint axis with MMB this way.
This is testing only and very hackish (couldn't find a proper way to get a screen's global coordinates offset).
2005-02-18 01:34:38 +00:00
d2f4ba4549 Initial new transform commit.
Disabled behind defines. Uncomment //#define NEWTRANSFORM in transform.h to enable.

Use at your own risk

For more info, see Wiki: http://wiki.blender.org/bin/view.pl/Blenderdev/TransformRefactoring
And tuhopuu mailing list: http://projects.blender.org/pipermail/tuhopuu-devel/

Notes for Ton (things that could need bulldozing:
- TransData conversions. Objects is ok, but others could be rechecked. (some still use totsel). Need to add pose mode support.
- Need more icons in the PET mode dropdown (in the 3D view header) for the new modes
- Add new transform calls to Toolbox and Menus and the one right after Extrude.

That's pretty much all I can think of now.
2005-02-14 02:53:36 +00:00