2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/transform/transform_conversions.c
|
|
|
|
* \ingroup edtransform
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#ifndef WIN32
|
|
|
|
#include <unistd.h>
|
|
|
|
#else
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
#include "DNA_meta_types.h"
|
2009-01-02 23:58:03 +00:00
|
|
|
#include "DNA_node_types.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
2009-01-21 07:01:20 +00:00
|
|
|
#include "DNA_sequence_types.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_constraint_types.h"
|
2010-08-10 05:41:51 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
2011-01-10 22:10:28 +00:00
|
|
|
#include "DNA_gpencil_types.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2010-08-16 05:46:10 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_action.h"
|
|
|
|
#include "BKE_armature.h"
|
2009-01-04 14:14:06 +00:00
|
|
|
#include "BKE_context.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_curve.h"
|
|
|
|
#include "BKE_constraint.h"
|
|
|
|
#include "BKE_depsgraph.h"
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#include "BKE_fcurve.h"
|
2011-01-10 22:10:28 +00:00
|
|
|
#include "BKE_gpencil.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_key.h"
|
|
|
|
#include "BKE_main.h"
|
|
|
|
#include "BKE_modifier.h"
|
2009-06-23 13:25:31 +00:00
|
|
|
#include "BKE_nla.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_object.h"
|
|
|
|
#include "BKE_particle.h"
|
2009-12-13 14:56:45 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_pointcache.h"
|
|
|
|
#include "BKE_bmesh.h"
|
2010-03-08 09:06:58 +00:00
|
|
|
#include "BKE_scene.h"
|
2010-11-17 12:02:36 +00:00
|
|
|
#include "BKE_report.h"
|
2011-01-07 19:18:31 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
#include "ED_anim_api.h"
|
2009-01-24 13:45:24 +00:00
|
|
|
#include "ED_armature.h"
|
2009-02-20 20:39:27 +00:00
|
|
|
#include "ED_particle.h"
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_image.h"
|
2008-12-29 06:06:59 +00:00
|
|
|
#include "ED_keyframing.h"
|
|
|
|
#include "ED_keyframes_edit.h"
|
2009-02-17 09:34:21 +00:00
|
|
|
#include "ED_object.h"
|
2009-07-07 06:21:38 +00:00
|
|
|
#include "ED_markers.h"
|
2008-12-31 22:43:29 +00:00
|
|
|
#include "ED_mesh.h"
|
2011-07-22 15:28:50 +00:00
|
|
|
#include "ED_node.h"
|
2009-01-24 13:45:24 +00:00
|
|
|
#include "ED_types.h"
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_uvedit.h"
|
2011-02-12 17:51:02 +00:00
|
|
|
#include "ED_util.h" /* for crazyspace correction */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
#include "UI_view2d.h"
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_editVert.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
#include "RNA_access.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
extern ListBase editelems;
|
|
|
|
|
|
|
|
#include "transform.h"
|
|
|
|
|
|
|
|
#include "BLO_sys_types.h" // for intptr_t support
|
|
|
|
|
|
|
|
/* local function prototype - for Object/Bone Constraints */
|
|
|
|
static short constraints_list_needinv(TransInfo *t, ListBase *list);
|
|
|
|
|
|
|
|
/* ************************** Functions *************************** */
|
|
|
|
|
2010-09-21 12:27:09 +00:00
|
|
|
static void qsort_trans_data(TransInfo *t, TransData *head, TransData *tail, TransData *temp) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *ihead = head;
|
|
|
|
TransData *itail = tail;
|
2010-09-21 12:27:09 +00:00
|
|
|
*temp = *head;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
while (head < tail)
|
|
|
|
{
|
2010-09-21 12:27:09 +00:00
|
|
|
if (t->flag & T_PROP_CONNECTED) {
|
|
|
|
while ((tail->dist >= temp->dist) && (head < tail))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tail--;
|
|
|
|
}
|
|
|
|
else {
|
2010-09-21 12:27:09 +00:00
|
|
|
while ((tail->rdist >= temp->rdist) && (head < tail))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tail--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (head != tail)
|
|
|
|
{
|
|
|
|
*head = *tail;
|
|
|
|
head++;
|
|
|
|
}
|
|
|
|
|
2010-09-21 12:27:09 +00:00
|
|
|
if (t->flag & T_PROP_CONNECTED) {
|
|
|
|
while ((head->dist <= temp->dist) && (head < tail))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
head++;
|
|
|
|
}
|
|
|
|
else {
|
2010-09-21 12:27:09 +00:00
|
|
|
while ((head->rdist <= temp->rdist) && (head < tail))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
head++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (head != tail)
|
|
|
|
{
|
|
|
|
*tail = *head;
|
|
|
|
tail--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-21 12:27:09 +00:00
|
|
|
*head = *temp;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ihead < head) {
|
2010-09-21 12:27:09 +00:00
|
|
|
qsort_trans_data(t, ihead, head-1, temp);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
if (itail > head) {
|
2010-09-21 12:27:09 +00:00
|
|
|
qsort_trans_data(t, head+1, itail, temp);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void sort_trans_data_dist(TransInfo *t) {
|
2010-09-21 12:27:09 +00:00
|
|
|
TransData temp;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *start = t->data;
|
|
|
|
int i = 1;
|
|
|
|
|
|
|
|
while(i < t->total && start->flag & TD_SELECTED) {
|
|
|
|
start++;
|
|
|
|
i++;
|
|
|
|
}
|
2010-09-21 12:27:09 +00:00
|
|
|
qsort_trans_data(t, start, t->data + t->total - 1, &temp);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void sort_trans_data(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
TransData *sel, *unsel;
|
|
|
|
TransData temp;
|
|
|
|
unsel = t->data;
|
|
|
|
sel = t->data;
|
|
|
|
sel += t->total - 1;
|
|
|
|
while (sel > unsel) {
|
|
|
|
while (unsel->flag & TD_SELECTED) {
|
|
|
|
unsel++;
|
|
|
|
if (unsel == sel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (!(sel->flag & TD_SELECTED)) {
|
|
|
|
sel--;
|
|
|
|
if (unsel == sel) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
temp = *unsel;
|
|
|
|
*unsel = *sel;
|
|
|
|
*sel = temp;
|
|
|
|
sel--;
|
|
|
|
unsel++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* distance calculated from not-selected vertex to nearest selected vertex
|
|
|
|
warning; this is loops inside loop, has minor N^2 issues, but by sorting list it is OK */
|
|
|
|
static void set_prop_dist(TransInfo *t, short with_dist)
|
|
|
|
{
|
|
|
|
TransData *tob;
|
|
|
|
int a;
|
|
|
|
|
|
|
|
for(a=0, tob= t->data; a<t->total; a++, tob++) {
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tob->rdist= 0.0f; // init, it was mallocced
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if((tob->flag & TD_SELECTED)==0) {
|
|
|
|
TransData *td;
|
|
|
|
int i;
|
|
|
|
float dist, vec[3];
|
|
|
|
|
|
|
|
tob->rdist = -1.0f; // signal for next loop
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (i = 0, td= t->data; i < t->total; i++, td++) {
|
|
|
|
if(td->flag & TD_SELECTED) {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, tob->center, td->center);
|
|
|
|
mul_m3_v3(tob->mtx, vec);
|
|
|
|
dist = normalize_v3(vec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (tob->rdist == -1.0f) {
|
|
|
|
tob->rdist = dist;
|
|
|
|
}
|
|
|
|
else if (dist < tob->rdist) {
|
|
|
|
tob->rdist = dist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else break; // by definition transdata has selected items in beginning
|
|
|
|
}
|
|
|
|
if (with_dist) {
|
|
|
|
tob->dist = tob->rdist;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** CONVERSIONS ************************* */
|
|
|
|
|
|
|
|
/* ********************* texture space ********* */
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void createTransTexspace(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene = t->scene;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td;
|
|
|
|
Object *ob;
|
|
|
|
ID *id;
|
2009-10-15 09:00:40 +00:00
|
|
|
short *texflag;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
ob = OBACT;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ob == NULL) { // Shouldn't logically happen, but still...
|
|
|
|
t->total = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
id = ob->data;
|
|
|
|
if(id == NULL || !ELEM3( GS(id->name), ID_ME, ID_CU, ID_MB )) {
|
|
|
|
t->total = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
t->total = 1;
|
|
|
|
td= t->data= MEM_callocN(sizeof(TransData), "TransTexspace");
|
|
|
|
td->ext= t->ext= MEM_callocN(sizeof(TransDataExtension), "TransTexspace");
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->flag= TD_SELECTED;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, ob->obmat[3]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->ob = ob;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(td->mtx, ob->obmat);
|
|
|
|
copy_m3_m4(td->axismtx, ob->obmat);
|
|
|
|
normalize_m3(td->axismtx);
|
|
|
|
invert_m3_m3(td->smtx, td->mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (give_obdata_texspace(ob, &texflag, &td->loc, &td->ext->size, &td->ext->rot)) {
|
2011-01-05 17:27:26 +00:00
|
|
|
ob->dtx |= OB_TEXSPACE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*texflag &= ~AUTOSPACE;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
|
|
|
copy_v3_v3(td->ext->irot, td->ext->rot);
|
|
|
|
copy_v3_v3(td->ext->isize, td->ext->size);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* edge (for crease) ***** */
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void createTransEdge(TransInfo *t) {
|
2010-01-09 20:42:35 +00:00
|
|
|
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td = NULL;
|
|
|
|
EditEdge *eed;
|
|
|
|
float mtx[3][3], smtx[3][3];
|
|
|
|
int count=0, countsel=0;
|
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
|
|
|
|
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
if(eed->h==0) {
|
|
|
|
if (eed->f & SELECT) countsel++;
|
|
|
|
if (propmode) count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (countsel == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(propmode) {
|
|
|
|
t->total = count;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->total = countsel;
|
|
|
|
}
|
|
|
|
|
|
|
|
td= t->data= MEM_callocN(t->total * sizeof(TransData), "TransCrease");
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mtx, t->obedit->obmat);
|
|
|
|
invert_m3_m3(smtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
if(eed->h==0 && (eed->f & SELECT || propmode)) {
|
|
|
|
/* need to set center for center calculations */
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->center, eed->v1->co, eed->v2->co);
|
|
|
|
mul_v3_fl(td->center, 0.5f);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->loc= NULL;
|
|
|
|
if (eed->f & SELECT)
|
|
|
|
td->flag= TD_SELECTED;
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->flag= 0;
|
|
|
|
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->ext = NULL;
|
|
|
|
if (t->mode == TFM_BWEIGHT) {
|
|
|
|
td->val = &(eed->bweight);
|
|
|
|
td->ival = eed->bweight;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->val = &(eed->crease);
|
|
|
|
td->ival = eed->crease;
|
|
|
|
}
|
|
|
|
|
|
|
|
td++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* pose mode ************* */
|
|
|
|
|
|
|
|
static bKinematicConstraint *has_targetless_ik(bPoseChannel *pchan)
|
|
|
|
{
|
|
|
|
bConstraint *con= pchan->constraints.first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(;con; con= con->next) {
|
2011-03-28 17:06:15 +00:00
|
|
|
if(con->type==CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bKinematicConstraint *data= con->data;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
if(data->tar==NULL)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return data;
|
2009-07-12 02:01:13 +00:00
|
|
|
if(data->tar->type==OB_ARMATURE && data->subtarget[0]==0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static short apply_targetless_ik(Object *ob)
|
|
|
|
{
|
|
|
|
bPoseChannel *pchan, *parchan, *chanlist[256];
|
|
|
|
bKinematicConstraint *data;
|
|
|
|
int segcount, apply= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* now we got a difficult situation... we have to find the
|
2009-07-12 02:01:13 +00:00
|
|
|
target-less IK pchans, and apply transformation to the all
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
pchans that were in the chain */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
data= has_targetless_ik(pchan);
|
|
|
|
if(data && (data->flag & CONSTRAINT_IK_AUTO)) {
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* fill the array with the bones of the chain (armature.c does same, keep it synced) */
|
|
|
|
segcount= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* exclude tip from chain? */
|
|
|
|
if(!(data->flag & CONSTRAINT_IK_TIP))
|
|
|
|
parchan= pchan->parent;
|
|
|
|
else
|
|
|
|
parchan= pchan;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Find the chain's root & count the segments needed */
|
|
|
|
for (; parchan; parchan=parchan->parent){
|
|
|
|
chanlist[segcount]= parchan;
|
|
|
|
segcount++;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(segcount==data->rootbone || segcount>255) break; // 255 is weak
|
|
|
|
}
|
|
|
|
for(;segcount;segcount--) {
|
|
|
|
Bone *bone;
|
|
|
|
float rmat[4][4], tmat[4][4], imat[4][4];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */
|
|
|
|
/* we put in channel the entire result of rmat= (channel * constraint * IK) */
|
|
|
|
/* pose_mat(b) = pose_mat(b-1) * offs_bone * rmat */
|
|
|
|
/* rmat = pose_mat(b) * inv( pose_mat(b-1) * offs_bone ) */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
parchan= chanlist[segcount-1];
|
|
|
|
bone= parchan->bone;
|
|
|
|
bone->flag |= BONE_TRANSFORM; /* ensures it gets an auto key inserted */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(parchan->parent) {
|
|
|
|
Bone *parbone= parchan->parent->bone;
|
|
|
|
float offs_bone[4][4];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* offs_bone = yoffs(b-1) + root(b) + bonemat(b) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m3(offs_bone, bone->bone_mat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* The bone's root offset (is in the parent's coordinate system) */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(offs_bone[3], bone->head);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Get the length translation of parent (length along y axis) */
|
|
|
|
offs_bone[3][1]+= parbone->length;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* pose_mat(b-1) * offs_bone */
|
|
|
|
if(parchan->bone->flag & BONE_HINGE) {
|
|
|
|
/* the rotation of the parent restposition */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(rmat, parbone->arm_mat); /* rmat used as temp */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* the location of actual parent transform */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(rmat[3], offs_bone[3]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
offs_bone[3][0]= offs_bone[3][1]= offs_bone[3][2]= 0.0f;
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(parchan->parent->pose_mat, rmat[3]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(tmat, offs_bone, rmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else if(parchan->bone->flag & BONE_NO_SCALE) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(tmat, offs_bone, parchan->parent->pose_mat);
|
|
|
|
normalize_m4(tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(tmat, offs_bone, parchan->parent->pose_mat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(imat, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m3(tmat, bone->bone_mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(tmat[3], bone->head);
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(imat, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
/* result matrix */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_m4m4(rmat, parchan->pose_mat, imat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* apply and decompose, doesn't work for constraints or non-uniform scale well */
|
|
|
|
{
|
2010-12-03 12:30:59 +00:00
|
|
|
float rmat3[3][3], qrmat[3][3], imat3[3][3], smat[3][3];
|
2010-10-17 10:46:06 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(rmat3, rmat);
|
2009-09-02 00:42:12 +00:00
|
|
|
|
|
|
|
/* rotation */
|
2010-10-17 10:46:06 +00:00
|
|
|
/* [#22409] is partially caused by this, as slight numeric error introduced during
|
|
|
|
* the solving process leads to locked-axis values changing. However, we cannot modify
|
|
|
|
* the values here, or else there are huge discreptancies between IK-solver (interactive)
|
|
|
|
* and applied poses.
|
|
|
|
*/
|
|
|
|
if (parchan->rotmode > 0)
|
|
|
|
mat3_to_eulO(parchan->eul, parchan->rotmode,rmat3);
|
2009-09-28 10:19:20 +00:00
|
|
|
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
|
2010-10-17 10:46:06 +00:00
|
|
|
mat3_to_axis_angle(parchan->rotAxis, &parchan->rotAngle,rmat3);
|
2009-09-02 00:42:12 +00:00
|
|
|
else
|
2010-10-17 10:46:06 +00:00
|
|
|
mat3_to_quat(parchan->quat,rmat3);
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* for size, remove rotation */
|
|
|
|
/* causes problems with some constraints (so apply only if needed) */
|
|
|
|
if (data->flag & CONSTRAINT_IK_STRETCH) {
|
2009-09-02 00:42:12 +00:00
|
|
|
if (parchan->rotmode > 0)
|
2009-11-10 20:43:45 +00:00
|
|
|
eulO_to_mat3( qrmat,parchan->eul, parchan->rotmode);
|
2009-09-28 10:19:20 +00:00
|
|
|
else if (parchan->rotmode == ROT_MODE_AXISANGLE)
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_mat3( qrmat,parchan->rotAxis, parchan->rotAngle);
|
2009-09-02 00:42:12 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_mat3( qrmat,parchan->quat);
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2010-12-03 12:30:59 +00:00
|
|
|
invert_m3_m3(imat3, qrmat);
|
|
|
|
mul_m3_m3m3(smat, rmat3, imat3);
|
2009-11-10 20:43:45 +00:00
|
|
|
mat3_to_size( parchan->size,smat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* causes problems with some constraints (e.g. childof), so disable this */
|
|
|
|
/* as it is IK shouldn't affect location directly */
|
2011-09-12 04:14:12 +00:00
|
|
|
/* copy_v3_v3(parchan->loc, rmat[3]); */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
apply= 1;
|
|
|
|
data->flag &= ~CONSTRAINT_IK_AUTO;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return apply;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, TransData *td)
|
|
|
|
{
|
|
|
|
Bone *bone= pchan->bone;
|
2009-11-25 14:59:02 +00:00
|
|
|
float pmat[3][3], omat[3][3], bmat[3][3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float cmat[3][3], tmat[3][3];
|
|
|
|
float vec[3];
|
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, pchan->pose_mat[3]);
|
|
|
|
copy_v3_v3(td->center, vec);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->ob = ob;
|
2009-03-02 01:22:02 +00:00
|
|
|
td->flag = TD_SELECTED;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (bone->flag & BONE_HINGE_CHILD_TRANSFORM)
|
|
|
|
{
|
|
|
|
td->flag |= TD_NOCENTER;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (bone->flag & BONE_TRANSFORM_CHILD)
|
|
|
|
{
|
|
|
|
td->flag |= TD_NOCENTER;
|
|
|
|
td->flag |= TD_NO_LOC;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->protectflag= pchan->protectflag;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc = pchan->loc;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, pchan->loc);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->ext->size= pchan->size;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->isize, pchan->size);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-02 00:42:12 +00:00
|
|
|
if (pchan->rotmode > 0) {
|
2009-03-02 01:22:02 +00:00
|
|
|
td->ext->rot= pchan->eul;
|
2009-10-22 02:14:11 +00:00
|
|
|
td->ext->rotAxis= NULL;
|
|
|
|
td->ext->rotAngle= NULL;
|
2009-03-02 01:22:02 +00:00
|
|
|
td->ext->quat= NULL;
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->irot, pchan->eul);
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2009-10-22 02:14:11 +00:00
|
|
|
else if (pchan->rotmode == ROT_MODE_AXISANGLE) {
|
|
|
|
td->ext->rot= NULL;
|
|
|
|
td->ext->rotAxis= pchan->rotAxis;
|
|
|
|
td->ext->rotAngle= &pchan->rotAngle;
|
|
|
|
td->ext->quat= NULL;
|
|
|
|
|
|
|
|
td->ext->irotAngle= pchan->rotAngle;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->irotAxis, pchan->rotAxis);
|
2009-10-22 02:14:11 +00:00
|
|
|
}
|
2009-03-02 01:22:02 +00:00
|
|
|
else {
|
|
|
|
td->ext->rot= NULL;
|
2009-10-22 02:14:11 +00:00
|
|
|
td->ext->rotAxis= NULL;
|
|
|
|
td->ext->rotAngle= NULL;
|
2009-03-02 01:22:02 +00:00
|
|
|
td->ext->quat= pchan->quat;
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2011-10-28 12:40:15 +00:00
|
|
|
copy_qt_qt(td->ext->iquat, pchan->quat);
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
td->ext->rotOrder= pchan->rotmode;
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* proper way to get parent transform + own transform + constraints transform */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(omat, ob->obmat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-10-24 06:16:44 +00:00
|
|
|
if (ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION))
|
2009-11-25 18:48:29 +00:00
|
|
|
unit_m3(bmat);
|
|
|
|
else
|
|
|
|
copy_m3_m3(bmat, pchan->bone->bone_mat);
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if (pchan->parent) {
|
|
|
|
if(pchan->bone->flag & BONE_HINGE)
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(pmat, pchan->parent->bone->arm_mat);
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(pmat, pchan->parent->pose_mat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (constraints_list_needinv(t, &pchan->constraints)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(tmat, pchan->constinv);
|
|
|
|
invert_m3_m3(cmat, tmat);
|
2011-02-13 10:52:18 +00:00
|
|
|
mul_serie_m3(td->mtx, bmat, pmat, omat, cmat, NULL,NULL,NULL,NULL); // dang mulserie swaps args
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
2011-02-13 10:52:18 +00:00
|
|
|
mul_serie_m3(td->mtx, bmat, pmat, omat, NULL,NULL,NULL,NULL,NULL); // dang mulserie swaps args
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (constraints_list_needinv(t, &pchan->constraints)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(tmat, pchan->constinv);
|
|
|
|
invert_m3_m3(cmat, tmat);
|
2011-02-13 10:52:18 +00:00
|
|
|
mul_serie_m3(td->mtx, bmat, omat, cmat, NULL,NULL,NULL,NULL,NULL); // dang mulserie swaps args
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2009-11-25 14:59:02 +00:00
|
|
|
mul_m3_m3m3(td->mtx, omat, bmat); // Mat3MulMat3 has swapped args!
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m3_m3(td->smtx, td->mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-10-24 06:16:44 +00:00
|
|
|
/* exceptional case: rotate the pose bone which also applies transformation
|
|
|
|
* when a parentless bone has BONE_NO_LOCAL_LOCATION [] */
|
|
|
|
if (!ELEM(t->mode, TFM_TRANSLATION, TFM_RESIZE) && (pchan->bone->flag & BONE_NO_LOCAL_LOCATION)) {
|
|
|
|
if(pchan->parent) {
|
|
|
|
/* same as td->smtx but without pchan->bone->bone_mat */
|
|
|
|
td->flag |= TD_PBONE_LOCAL_MTX_C;
|
|
|
|
mul_m3_m3m3(td->ext->l_smtx, pchan->bone->bone_mat, td->smtx);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->flag |= TD_PBONE_LOCAL_MTX_P;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* for axismat we use bone's own transform */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(pmat, pchan->pose_mat);
|
|
|
|
mul_m3_m3m3(td->axismtx, omat, pmat);
|
|
|
|
normalize_m3(td->axismtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-24 10:03:19 +00:00
|
|
|
if (t->mode==TFM_BONESIZE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bArmature *arm= t->poseobj->data;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(arm->drawtype==ARM_ENVELOPE) {
|
|
|
|
td->loc= NULL;
|
|
|
|
td->val= &bone->dist;
|
|
|
|
td->ival= bone->dist;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// abusive storage of scale in the loc pointer :)
|
|
|
|
td->loc= &bone->xwidth;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->val= NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* in this case we can do target-less IK grabbing */
|
2009-01-24 10:03:19 +00:00
|
|
|
if (t->mode==TFM_TRANSLATION) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bKinematicConstraint *data= has_targetless_ik(pchan);
|
|
|
|
if(data) {
|
|
|
|
if(data->flag & CONSTRAINT_IK_TIP) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(data->grabtarget, pchan->pose_tail);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(data->grabtarget, pchan->pose_head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
td->loc = data->grabtarget;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
data->flag |= CONSTRAINT_IK_AUTO;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only object matrix correction */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->mtx, omat);
|
|
|
|
invert_m3_m3(td->smtx, td->mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* store reference to first constraint */
|
|
|
|
td->con= pchan->constraints.first;
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
Bone *bone= lb->first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(;bone;bone= bone->next) {
|
|
|
|
if((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED))
|
|
|
|
{
|
|
|
|
bone->flag |= BONE_HINGE_CHILD_TRANSFORM;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
else if (bone->flag & BONE_TRANSFORM && (mode == TFM_ROTATION || mode == TFM_TRACKBALL) && around == V3D_LOCAL)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
bone->flag |= BONE_TRANSFORM_CHILD;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
bone->flag &= ~BONE_TRANSFORM;
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
bone_children_clear_transflag(mode, around, &bone->childbase);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-22 10:52:30 +00:00
|
|
|
/* sets transform flags in the bones
|
|
|
|
* returns total number of bones with BONE_TRANSFORM */
|
2009-07-12 02:01:13 +00:00
|
|
|
int count_set_pose_transflags(int *out_mode, short around, Object *ob)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
bArmature *arm= ob->data;
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
Bone *bone;
|
2009-07-12 02:01:13 +00:00
|
|
|
int mode = *out_mode;
|
|
|
|
int hastranslation = 0;
|
|
|
|
int total = 0;
|
|
|
|
|
2010-03-09 08:31:41 +00:00
|
|
|
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
|
2009-07-12 02:01:13 +00:00
|
|
|
bone = pchan->bone;
|
2010-11-03 01:56:02 +00:00
|
|
|
if (PBONE_VISIBLE(arm, bone)) {
|
2011-07-03 18:21:37 +00:00
|
|
|
if ((bone->flag & BONE_SELECTED))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bone->flag |= BONE_TRANSFORM;
|
|
|
|
else
|
|
|
|
bone->flag &= ~BONE_TRANSFORM;
|
2010-03-09 08:31:41 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bone->flag &= ~BONE_HINGE_CHILD_TRANSFORM;
|
|
|
|
bone->flag &= ~BONE_TRANSFORM_CHILD;
|
|
|
|
}
|
2009-08-26 02:18:47 +00:00
|
|
|
else
|
|
|
|
bone->flag &= ~BONE_TRANSFORM;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* make sure no bone can be transformed when a parent is transformed */
|
|
|
|
/* since pchans are depsgraph sorted, the parents are in beginning of list */
|
2009-07-12 02:01:13 +00:00
|
|
|
if(mode != TFM_BONESIZE) {
|
|
|
|
for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
|
|
|
|
bone = pchan->bone;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bone->flag & BONE_TRANSFORM)
|
2009-07-12 02:01:13 +00:00
|
|
|
bone_children_clear_transflag(mode, around, &bone->childbase);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* now count, and check if we have autoIK or have to switch from translate to rotate */
|
2009-07-12 02:01:13 +00:00
|
|
|
hastranslation = 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
|
|
|
|
bone = pchan->bone;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bone->flag & BONE_TRANSFORM) {
|
2009-07-12 02:01:13 +00:00
|
|
|
total++;
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if(mode == TFM_TRANSLATION) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if( has_targetless_ik(pchan)==NULL ) {
|
|
|
|
if(pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) {
|
|
|
|
if(pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM)
|
2009-07-12 02:01:13 +00:00
|
|
|
hastranslation = 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else if((pchan->protectflag & OB_LOCK_LOC)!=OB_LOCK_LOC)
|
2009-07-12 02:01:13 +00:00
|
|
|
hastranslation = 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
2009-07-12 02:01:13 +00:00
|
|
|
hastranslation = 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if there are no translatable bones, do rotation */
|
2009-07-12 02:01:13 +00:00
|
|
|
if(mode == TFM_TRANSLATION && !hastranslation)
|
|
|
|
{
|
|
|
|
*out_mode = TFM_ROTATION;
|
|
|
|
}
|
|
|
|
|
|
|
|
return total;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* -------- Auto-IK ---------- */
|
|
|
|
|
|
|
|
/* adjust pose-channel's auto-ik chainlen */
|
|
|
|
static void pchan_autoik_adjust (bPoseChannel *pchan, short chainlen)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* don't bother to search if no valid constraints */
|
|
|
|
if ((pchan->constflag & (PCHAN_HAS_IK|PCHAN_HAS_TARGET))==0)
|
|
|
|
return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* check if pchan has ik-constraint */
|
|
|
|
for (con= pchan->constraints.first; con; con= con->next) {
|
2011-03-28 17:06:15 +00:00
|
|
|
if (con->type == CONSTRAINT_TYPE_KINEMATIC && (con->enforce!=0.0f)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bKinematicConstraint *data= con->data;
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only accept if a temporary one (for auto-ik) */
|
|
|
|
if (data->flag & CONSTRAINT_IK_TEMP) {
|
|
|
|
/* chainlen is new chainlen, but is limited by maximum chainlen */
|
|
|
|
if ((chainlen==0) || (chainlen > data->max_rootbone))
|
|
|
|
data->rootbone= data->max_rootbone;
|
|
|
|
else
|
|
|
|
data->rootbone= chainlen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* change the chain-length of auto-ik */
|
|
|
|
void transform_autoik_update (TransInfo *t, short mode)
|
|
|
|
{
|
2009-06-23 00:41:55 +00:00
|
|
|
short *chainlen= &t->settings->autoik_chainlen;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bPoseChannel *pchan;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* mode determines what change to apply to chainlen */
|
|
|
|
if (mode == 1) {
|
|
|
|
/* mode=1 is from WHEELMOUSEDOWN... increases len */
|
|
|
|
(*chainlen)++;
|
|
|
|
}
|
|
|
|
else if (mode == -1) {
|
|
|
|
/* mode==-1 is from WHEELMOUSEUP... decreases len */
|
|
|
|
if (*chainlen > 0) (*chainlen)--;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* sanity checks (don't assume t->poseobj is set, or that it is an armature) */
|
|
|
|
if (ELEM(NULL, t->poseobj, t->poseobj->pose))
|
|
|
|
return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* apply to all pose-channels */
|
|
|
|
for (pchan=t->poseobj->pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
pchan_autoik_adjust(pchan, *chainlen);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* frees temporal IKs */
|
|
|
|
static void pose_grab_with_ik_clear(Object *ob)
|
|
|
|
{
|
|
|
|
bKinematicConstraint *data;
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
bConstraint *con, *next;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
|
|
|
/* clear all temporary lock flags */
|
|
|
|
pchan->ikflag &= ~(BONE_IK_NO_XDOF_TEMP|BONE_IK_NO_YDOF_TEMP|BONE_IK_NO_ZDOF_TEMP);
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
pchan->constflag &= ~(PCHAN_HAS_IK|PCHAN_HAS_TARGET);
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* remove all temporary IK-constraints added */
|
|
|
|
for (con= pchan->constraints.first; con; con= next) {
|
|
|
|
next= con->next;
|
|
|
|
if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
|
|
|
|
data= con->data;
|
|
|
|
if (data->flag & CONSTRAINT_IK_TEMP) {
|
|
|
|
BLI_remlink(&pchan->constraints, con);
|
|
|
|
MEM_freeN(con->data);
|
|
|
|
MEM_freeN(con);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
pchan->constflag |= PCHAN_HAS_IK;
|
|
|
|
if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
|
|
|
|
pchan->constflag |= PCHAN_HAS_TARGET;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* adds the IK to pchan - returns if added */
|
|
|
|
static short pose_grab_with_ik_add(bPoseChannel *pchan)
|
|
|
|
{
|
2011-02-01 05:15:32 +00:00
|
|
|
bKinematicConstraint *targetless = NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bKinematicConstraint *data;
|
|
|
|
bConstraint *con;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Sanity check */
|
2009-07-12 02:01:13 +00:00
|
|
|
if (pchan == NULL)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Rule: not if there's already an IK on this channel */
|
|
|
|
for (con= pchan->constraints.first; con; con= con->next) {
|
|
|
|
if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
|
2011-02-01 05:15:32 +00:00
|
|
|
data= con->data;
|
|
|
|
|
|
|
|
if (data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]=='\0')) {
|
|
|
|
/* make reference to constraint to base things off later (if it's the last targetless constraint encountered) */
|
|
|
|
targetless = (bKinematicConstraint *)con->data;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
|
2009-02-17 09:34:21 +00:00
|
|
|
if (con->enforce!=0.0f) {
|
2011-02-01 05:15:32 +00:00
|
|
|
data->flag |= CONSTRAINT_IK_AUTO;
|
|
|
|
|
|
|
|
/* if no chain length has been specified, just make things obey standard rotation locks too */
|
|
|
|
if (data->rootbone == 0) {
|
|
|
|
for (; pchan; pchan=pchan->parent) {
|
|
|
|
/* here, we set ik-settings for bone from pchan->protectflag */
|
|
|
|
// XXX: careful with quats/axis-angle rotations where we're locking 4d components
|
|
|
|
if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
|
|
|
|
if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
|
|
|
|
if (pchan->protectflag & OB_LOCK_ROTZ) pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2011-02-01 05:15:32 +00:00
|
|
|
|
2009-02-17 09:34:21 +00:00
|
|
|
if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0f))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-11 19:58:30 +00:00
|
|
|
con = add_pose_constraint(NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
pchan->constflag |= (PCHAN_HAS_IK|PCHAN_HAS_TARGET); /* for draw, but also for detecting while pose solving */
|
|
|
|
data= con->data;
|
2011-02-01 05:15:32 +00:00
|
|
|
if (targetless) {
|
|
|
|
/* if exists, use values from last targetless (but disabled) IK-constraint as base */
|
|
|
|
*data = *targetless;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
data->flag= CONSTRAINT_IK_TIP;
|
|
|
|
data->flag |= CONSTRAINT_IK_TEMP|CONSTRAINT_IK_AUTO;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(data->grabtarget, pchan->pose_tail);
|
2011-02-01 00:43:28 +00:00
|
|
|
data->rootbone= 0; /* watch-it! has to be 0 here, since we're still on the same bone for the first time through the loop [#25885] */
|
2010-10-17 10:46:06 +00:00
|
|
|
|
|
|
|
/* we only include bones that are part of a continual connected chain */
|
|
|
|
while (pchan) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* here, we set ik-settings for bone from pchan->protectflag */
|
2011-02-01 00:43:28 +00:00
|
|
|
// XXX: careful with quats/axis-angle rotations where we're locking 4d components
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (pchan->protectflag & OB_LOCK_ROTX) pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
|
|
|
|
if (pchan->protectflag & OB_LOCK_ROTY) pchan->ikflag |= BONE_IK_NO_YDOF_TEMP;
|
|
|
|
if (pchan->protectflag & OB_LOCK_ROTZ) pchan->ikflag |= BONE_IK_NO_ZDOF_TEMP;
|
2011-02-01 00:43:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* now we count this pchan as being included */
|
|
|
|
data->rootbone++;
|
2010-10-17 10:46:06 +00:00
|
|
|
|
|
|
|
/* continue to parent, but only if we're connected to it */
|
|
|
|
if (pchan->bone->flag & BONE_CONNECTED)
|
|
|
|
pchan = pchan->parent;
|
|
|
|
else
|
|
|
|
pchan = NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* make a copy of maximum chain-length */
|
|
|
|
data->max_rootbone= data->rootbone;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bone is a candidate to get IK, but we don't do it if it has children connected */
|
|
|
|
static short pose_grab_with_ik_children(bPose *pose, Bone *bone)
|
|
|
|
{
|
|
|
|
Bone *bonec;
|
|
|
|
short wentdeeper=0, added=0;
|
|
|
|
|
|
|
|
/* go deeper if children & children are connected */
|
|
|
|
for (bonec= bone->childbase.first; bonec; bonec= bonec->next) {
|
|
|
|
if (bonec->flag & BONE_CONNECTED) {
|
|
|
|
wentdeeper= 1;
|
|
|
|
added+= pose_grab_with_ik_children(pose, bonec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (wentdeeper==0) {
|
|
|
|
bPoseChannel *pchan= get_pose_channel(pose, bone->name);
|
|
|
|
if (pchan)
|
|
|
|
added+= pose_grab_with_ik_add(pchan);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return added;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* main call which adds temporal IK chains */
|
|
|
|
static short pose_grab_with_ik(Object *ob)
|
|
|
|
{
|
|
|
|
bArmature *arm;
|
|
|
|
bPoseChannel *pchan, *parent;
|
|
|
|
Bone *bonec;
|
|
|
|
short tot_ik= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-08-16 03:24:23 +00:00
|
|
|
if ((ob==NULL) || (ob->pose==NULL) || (ob->mode & OB_MODE_POSE)==0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
arm = ob->data;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Rule: allow multiple Bones (but they must be selected, and only one ik-solver per chain should get added) */
|
|
|
|
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
|
|
|
if (pchan->bone->layer & arm->layer) {
|
|
|
|
if (pchan->bone->flag & BONE_SELECTED) {
|
|
|
|
/* Rule: no IK for solitatry (unconnected) bones */
|
|
|
|
for (bonec=pchan->bone->childbase.first; bonec; bonec=bonec->next) {
|
|
|
|
if (bonec->flag & BONE_CONNECTED) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((pchan->bone->flag & BONE_CONNECTED)==0 && (bonec == NULL))
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* rule: if selected Bone is not a root bone, it gets a temporal IK */
|
|
|
|
if (pchan->parent) {
|
|
|
|
/* only adds if there's no IK yet (and no parent bone was selected) */
|
|
|
|
for (parent= pchan->parent; parent; parent= parent->parent) {
|
|
|
|
if (parent->bone->flag & BONE_SELECTED)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (parent == NULL)
|
|
|
|
tot_ik += pose_grab_with_ik_add(pchan);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* rule: go over the children and add IK to the tips */
|
|
|
|
tot_ik += pose_grab_with_ik_children(ob->pose, pchan->bone);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return (tot_ik) ? 1 : 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* only called with pose mode active object now */
|
2010-10-16 14:32:17 +00:00
|
|
|
static void createTransPose(TransInfo *t, Object *ob)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
bArmature *arm;
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
TransData *td;
|
|
|
|
TransDataExtension *tdx;
|
|
|
|
short ik_on= 0;
|
|
|
|
int i;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->total= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* check validity of state */
|
2009-01-24 10:03:19 +00:00
|
|
|
arm= get_armature(ob);
|
|
|
|
if ((arm==NULL) || (ob->pose==NULL)) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (arm->flag & ARM_RESTPOS) {
|
2009-01-24 10:03:19 +00:00
|
|
|
if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) {
|
2009-03-25 20:49:15 +00:00
|
|
|
// XXX use transform operator reports
|
2011-09-19 12:26:20 +00:00
|
|
|
// BKE_report(op->reports, RPT_ERROR, "Can't select linked when sync selection is enabled");
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do we need to add temporal IK chains? */
|
|
|
|
if ((arm->flag & ARM_AUTO_IK) && t->mode==TFM_TRANSLATION) {
|
|
|
|
ik_on= pose_grab_with_ik(ob);
|
|
|
|
if (ik_on) t->flag |= T_AUTOIK;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* set flags and count total (warning, can change transform to rotate) */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->total = count_set_pose_transflags(&t->mode, t->around, ob);
|
|
|
|
|
|
|
|
if(t->total == 0) return;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
t->flag |= T_POSE;
|
|
|
|
t->poseobj= ob; /* we also allow non-active objects to be transformed, in weightpaint */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* init trans data */
|
2010-03-22 09:30:00 +00:00
|
|
|
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransPoseBone");
|
|
|
|
tdx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransPoseBoneExt");
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(i=0; i<t->total; i++, td++, tdx++) {
|
|
|
|
td->ext= tdx;
|
|
|
|
td->val = NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* use pose channels to fill trans data */
|
|
|
|
td= t->data;
|
2009-01-24 10:03:19 +00:00
|
|
|
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
|
|
|
|
if (pchan->bone->flag & BONE_TRANSFORM) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
add_pose_transdata(t, pchan, ob, td);
|
|
|
|
td++;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-24 10:03:19 +00:00
|
|
|
if(td != (t->data+t->total)) {
|
2009-03-25 20:49:15 +00:00
|
|
|
// XXX use transform operator reports
|
2011-09-19 12:26:20 +00:00
|
|
|
// BKE_report(op->reports, RPT_DEBUG, "Bone selection count error");
|
2009-01-24 10:03:19 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* initialise initial auto=ik chainlen's? */
|
|
|
|
if (ik_on) transform_autoik_update(t, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* armature ************** */
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void createTransArmatureVerts(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
EditBone *ebo;
|
2008-12-31 22:43:29 +00:00
|
|
|
bArmature *arm= t->obedit->data;
|
2009-01-08 17:12:50 +00:00
|
|
|
ListBase *edbo = arm->edbo;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td;
|
|
|
|
float mtx[3][3], smtx[3][3], delta[3], bonemat[3][3];
|
2009-12-03 10:18:47 +00:00
|
|
|
|
|
|
|
/* special hack for envelope drawmode and scaling:
|
|
|
|
* to allow scaling the size of the envelope around single points,
|
|
|
|
* mode should become TFM_BONE_ENVELOPE in this case
|
|
|
|
*/
|
|
|
|
// TODO: maybe we need a separate hotkey for it, but this is consistent with 2.4x for now
|
|
|
|
if ((t->mode == TFM_RESIZE) && (arm->drawtype==ARM_ENVELOPE))
|
|
|
|
t->mode= TFM_BONE_ENVELOPE;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->total = 0;
|
2009-01-08 17:12:50 +00:00
|
|
|
for (ebo = edbo->first; ebo; ebo = ebo->next)
|
|
|
|
{
|
2010-03-09 08:31:41 +00:00
|
|
|
if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED))
|
2009-01-08 17:12:50 +00:00
|
|
|
{
|
|
|
|
if (t->mode==TFM_BONESIZE)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ebo->flag & BONE_SELECTED)
|
|
|
|
t->total++;
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
else if (t->mode==TFM_BONE_ROLL)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ebo->flag & BONE_SELECTED)
|
|
|
|
t->total++;
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
else
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ebo->flag & BONE_TIPSEL)
|
|
|
|
t->total++;
|
|
|
|
if (ebo->flag & BONE_ROOTSEL)
|
|
|
|
t->total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
if (!t->total) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mtx, t->obedit->obmat);
|
|
|
|
invert_m3_m3(smtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransEditBone");
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-08 17:12:50 +00:00
|
|
|
for (ebo = edbo->first; ebo; ebo = ebo->next)
|
|
|
|
{
|
|
|
|
ebo->oldlength = ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-09 08:31:41 +00:00
|
|
|
if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED))
|
|
|
|
{
|
2009-01-08 17:12:50 +00:00
|
|
|
if (t->mode==TFM_BONE_ENVELOPE)
|
|
|
|
{
|
|
|
|
if (ebo->flag & BONE_ROOTSEL)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->val= &ebo->rad_head;
|
|
|
|
td->ival= *td->val;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, ebo->head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->flag= TD_SELECTED;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc = NULL;
|
|
|
|
td->ext = NULL;
|
2010-02-26 02:33:04 +00:00
|
|
|
td->ob = t->obedit;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td++;
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
if (ebo->flag & BONE_TIPSEL)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->val= &ebo->rad_tail;
|
|
|
|
td->ival= *td->val;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, ebo->tail);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->flag= TD_SELECTED;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc = NULL;
|
|
|
|
td->ext = NULL;
|
2010-02-26 02:33:04 +00:00
|
|
|
td->ob = t->obedit;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td++;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
else if (t->mode==TFM_BONESIZE)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ebo->flag & BONE_SELECTED) {
|
2009-01-08 17:12:50 +00:00
|
|
|
if(arm->drawtype==ARM_ENVELOPE)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= NULL;
|
|
|
|
td->val= &ebo->dist;
|
|
|
|
td->ival= ebo->dist;
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
else
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
// abusive storage of scale in the loc pointer :)
|
|
|
|
td->loc= &ebo->xwidth;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->val= NULL;
|
|
|
|
}
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, ebo->head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->flag= TD_SELECTED;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* use local bone matrix */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(delta, ebo->tail, ebo->head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec_roll_to_mat3(delta, ebo->roll, bonemat);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(td->mtx, mtx, bonemat);
|
|
|
|
invert_m3_m3(td->smtx, td->mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->axismtx, td->mtx);
|
|
|
|
normalize_m3(td->axismtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->ext = NULL;
|
2010-02-26 02:33:04 +00:00
|
|
|
td->ob = t->obedit;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td++;
|
|
|
|
}
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
else if (t->mode==TFM_BONE_ROLL)
|
|
|
|
{
|
|
|
|
if (ebo->flag & BONE_SELECTED)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= NULL;
|
|
|
|
td->val= &(ebo->roll);
|
|
|
|
td->ival= ebo->roll;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, ebo->head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->flag= TD_SELECTED;
|
|
|
|
|
|
|
|
td->ext = NULL;
|
2010-02-26 02:33:04 +00:00
|
|
|
td->ob = t->obedit;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td++;
|
|
|
|
}
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ebo->flag & BONE_TIPSEL)
|
|
|
|
{
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, ebo->tail);
|
2011-10-02 19:57:34 +00:00
|
|
|
copy_v3_v3(td->center, (t->around==V3D_LOCAL) ? ebo->head : td->iloc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= ebo->tail;
|
|
|
|
td->flag= TD_SELECTED;
|
|
|
|
if (ebo->flag & BONE_EDITMODE_LOCKED)
|
|
|
|
td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(delta, ebo->tail, ebo->head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec_roll_to_mat3(delta, ebo->roll, td->axismtx);
|
|
|
|
|
|
|
|
if ((ebo->flag & BONE_ROOTSEL) == 0)
|
|
|
|
{
|
|
|
|
td->extra = ebo;
|
|
|
|
}
|
|
|
|
|
|
|
|
td->ext = NULL;
|
|
|
|
td->val = NULL;
|
2010-02-26 02:33:04 +00:00
|
|
|
td->ob = t->obedit;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td++;
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
if (ebo->flag & BONE_ROOTSEL)
|
|
|
|
{
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, ebo->head);
|
|
|
|
copy_v3_v3(td->center, td->iloc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= ebo->head;
|
|
|
|
td->flag= TD_SELECTED;
|
|
|
|
if (ebo->flag & BONE_EDITMODE_LOCKED)
|
|
|
|
td->protectflag = OB_LOCK_LOC|OB_LOCK_ROT|OB_LOCK_SCALE;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(delta, ebo->tail, ebo->head);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec_roll_to_mat3(delta, ebo->roll, td->axismtx);
|
|
|
|
|
|
|
|
td->extra = ebo; /* to fix roll */
|
|
|
|
|
|
|
|
td->ext = NULL;
|
|
|
|
td->val = NULL;
|
2010-02-26 02:33:04 +00:00
|
|
|
td->ob = t->obedit;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* meta elements ********* */
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void createTransMBallVerts(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-07-29 12:35:09 +00:00
|
|
|
MetaBall *mb = (MetaBall*)t->obedit->data;
|
2010-03-22 09:30:00 +00:00
|
|
|
MetaElem *ml;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td;
|
|
|
|
TransDataExtension *tx;
|
|
|
|
float mtx[3][3], smtx[3][3];
|
|
|
|
int count=0, countsel=0;
|
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
|
|
|
|
|
|
|
/* count totals */
|
2009-07-29 12:35:09 +00:00
|
|
|
for(ml= mb->editelems->first; ml; ml= ml->next) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(ml->flag & SELECT) countsel++;
|
|
|
|
if(propmode) count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* note: in prop mode we need at least 1 selected */
|
|
|
|
if (countsel==0) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
if(propmode) t->total = count;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else t->total = countsel;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td = t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(MBall EditMode)");
|
|
|
|
tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "MetaElement_TransExtension");
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mtx, t->obedit->obmat);
|
|
|
|
invert_m3_m3(smtx, mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-07-29 12:35:09 +00:00
|
|
|
for(ml= mb->editelems->first; ml; ml= ml->next) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(propmode || (ml->flag & SELECT)) {
|
|
|
|
td->loc= &ml->x;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
|
|
|
copy_v3_v3(td->center, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
if(ml->flag & SELECT) td->flag= TD_SELECTED | TD_USEQUAT | TD_SINGLESIZE;
|
|
|
|
else td->flag= TD_USEQUAT;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->ext = tx;
|
|
|
|
|
|
|
|
/* Radius of MetaElem (mass of MetaElem influence) */
|
|
|
|
if(ml->flag & MB_SCALE_RAD){
|
|
|
|
td->val = &ml->rad;
|
|
|
|
td->ival = ml->rad;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
td->val = &ml->s;
|
|
|
|
td->ival = ml->s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* expx/expy/expz determine "shape" of some MetaElem types */
|
|
|
|
tx->size = &ml->expx;
|
|
|
|
tx->isize[0] = ml->expx;
|
|
|
|
tx->isize[1] = ml->expy;
|
|
|
|
tx->isize[2] = ml->expz;
|
|
|
|
|
|
|
|
/* quat is used for rotation of MetaElem */
|
|
|
|
tx->quat = ml->quat;
|
2011-10-28 12:40:15 +00:00
|
|
|
copy_qt_qt(tx->iquat, ml->quat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
tx->rot = NULL;
|
|
|
|
|
|
|
|
td++;
|
|
|
|
tx++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* curve/surface ********* */
|
|
|
|
|
|
|
|
static void calc_distanceCurveVerts(TransData *head, TransData *tail) {
|
|
|
|
TransData *td, *td_near = NULL;
|
|
|
|
for (td = head; td<=tail; td++) {
|
|
|
|
if (td->flag & TD_SELECTED) {
|
|
|
|
td_near = td;
|
|
|
|
td->dist = 0.0f;
|
|
|
|
}
|
|
|
|
else if(td_near) {
|
|
|
|
float dist;
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3v3(td_near->center, td->center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (dist < (td-1)->dist) {
|
|
|
|
td->dist = (td-1)->dist;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->dist = dist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->dist = MAXFLOAT;
|
|
|
|
td->flag |= TD_NOTCONNECTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
td_near = NULL;
|
|
|
|
for (td = tail; td>=head; td--) {
|
|
|
|
if (td->flag & TD_SELECTED) {
|
|
|
|
td_near = td;
|
|
|
|
td->dist = 0.0f;
|
|
|
|
}
|
|
|
|
else if(td_near) {
|
|
|
|
float dist;
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3v3(td_near->center, td->center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_NOTCONNECTED || dist < td->dist || (td+1)->dist < td->dist) {
|
|
|
|
td->flag &= ~TD_NOTCONNECTED;
|
|
|
|
if (dist < (td+1)->dist) {
|
|
|
|
td->dist = (td+1)->dist;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->dist = dist;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Utility function for getting the handle data from bezier's */
|
2011-02-14 17:55:27 +00:00
|
|
|
static TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransDataCurveHandleFlags *hdata;
|
|
|
|
td->flag |= TD_BEZTRIPLE;
|
|
|
|
hdata = td->hdata = MEM_mallocN(sizeof(TransDataCurveHandleFlags), "CuHandle Data");
|
|
|
|
hdata->ih1 = bezt->h1;
|
|
|
|
hdata->h1 = &bezt->h1;
|
|
|
|
hdata->ih2 = bezt->h2; /* incase the second is not selected */
|
|
|
|
hdata->h2 = &bezt->h2;
|
|
|
|
return hdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void createTransCurveVerts(bContext *C, TransInfo *t)
|
|
|
|
{
|
2009-01-14 12:26:45 +00:00
|
|
|
Object *obedit= CTX_data_edit_object(C);
|
|
|
|
Curve *cu= obedit->data;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td = NULL;
|
2010-03-22 09:30:00 +00:00
|
|
|
Nurb *nu;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
BezTriple *bezt;
|
|
|
|
BPoint *bp;
|
|
|
|
float mtx[3][3], smtx[3][3];
|
|
|
|
int a;
|
|
|
|
int count=0, countsel=0;
|
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
2009-09-08 07:35:07 +00:00
|
|
|
short hide_handles = (cu->drawflag & CU_HIDE_HANDLES);
|
2010-07-25 11:57:36 +00:00
|
|
|
ListBase *nurbs;
|
|
|
|
|
2009-01-14 12:26:45 +00:00
|
|
|
/* to be sure */
|
|
|
|
if(cu->editnurb==NULL) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* count total of vertices, check identical as in 2nd loop for making transdata! */
|
2011-09-14 00:37:27 +00:00
|
|
|
nurbs= curve_editnurbs(cu);
|
2010-07-25 11:57:36 +00:00
|
|
|
for(nu= nurbs->first; nu; nu= nu->next) {
|
2009-09-08 00:23:33 +00:00
|
|
|
if(nu->type == CU_BEZIER) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
|
|
|
|
if(bezt->hide==0) {
|
2009-09-08 07:35:07 +00:00
|
|
|
if (hide_handles) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bezt->f2 & SELECT) countsel+=3;
|
|
|
|
if(propmode) count+= 3;
|
|
|
|
} else {
|
|
|
|
if(bezt->f1 & SELECT) countsel++;
|
|
|
|
if(bezt->f2 & SELECT) countsel++;
|
|
|
|
if(bezt->f3 & SELECT) countsel++;
|
|
|
|
if(propmode) count+= 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
|
|
|
|
if(bp->hide==0) {
|
|
|
|
if(propmode) count++;
|
|
|
|
if(bp->f1 & SELECT) countsel++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* note: in prop mode we need at least 1 selected */
|
|
|
|
if (countsel==0) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
if(propmode) t->total = count;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else t->total = countsel;
|
|
|
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Curve EditMode)");
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mtx, t->obedit->obmat);
|
|
|
|
invert_m3_m3(smtx, mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
td = t->data;
|
2010-07-25 11:57:36 +00:00
|
|
|
for(nu= nurbs->first; nu; nu= nu->next) {
|
2009-09-08 00:23:33 +00:00
|
|
|
if(nu->type == CU_BEZIER) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *head, *tail;
|
|
|
|
head = tail = td;
|
|
|
|
for(a=0, bezt= nu->bezt; a<nu->pntsu; a++, bezt++) {
|
|
|
|
if(bezt->hide==0) {
|
|
|
|
TransDataCurveHandleFlags *hdata = NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if( propmode ||
|
2009-09-08 07:35:07 +00:00
|
|
|
((bezt->f2 & SELECT) && hide_handles) ||
|
|
|
|
((bezt->f1 & SELECT) && hide_handles == 0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, bezt->vec[0]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= bezt->vec[0];
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:0]);
|
2009-09-08 07:35:07 +00:00
|
|
|
if (hide_handles) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
|
|
|
} else {
|
|
|
|
if(bezt->f1 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
|
|
|
}
|
|
|
|
td->ext = NULL;
|
|
|
|
td->val = NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-16 10:01:15 +00:00
|
|
|
hdata = initTransDataCurveHandles(td, bezt);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td++;
|
|
|
|
count++;
|
|
|
|
tail++;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* This is the Curve Point, the other two are handles */
|
|
|
|
if(propmode || (bezt->f2 & SELECT)) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, bezt->vec[1]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= bezt->vec[1];
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
|
|
|
td->ext = NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->mode==TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ /* TODO - make points scale */
|
|
|
|
td->val = &(bezt->radius);
|
|
|
|
td->ival = bezt->radius;
|
|
|
|
} else if (t->mode==TFM_TILT) {
|
|
|
|
td->val = &(bezt->alfa);
|
|
|
|
td->ival = bezt->alfa;
|
|
|
|
} else {
|
|
|
|
td->val = NULL;
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if ((bezt->f1&SELECT)==0 && (bezt->f3&SELECT)==0)
|
|
|
|
/* If the middle is selected but the sides arnt, this is needed */
|
|
|
|
if (hdata==NULL) { /* if the handle was not saved by the previous handle */
|
2009-10-16 10:01:15 +00:00
|
|
|
hdata = initTransDataCurveHandles(td, bezt);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td++;
|
|
|
|
count++;
|
|
|
|
tail++;
|
|
|
|
}
|
|
|
|
if( propmode ||
|
2009-09-08 07:35:07 +00:00
|
|
|
((bezt->f2 & SELECT) && hide_handles) ||
|
|
|
|
((bezt->f3 & SELECT) && hide_handles == 0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, bezt->vec[2]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= bezt->vec[2];
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, bezt->vec[(hide_handles || bezt->f2 & SELECT) ? 1:2]);
|
2009-09-08 07:35:07 +00:00
|
|
|
if (hide_handles) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bezt->f2 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
|
|
|
} else {
|
|
|
|
if(bezt->f3 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
|
|
|
}
|
|
|
|
td->ext = NULL;
|
|
|
|
td->val = NULL;
|
|
|
|
|
|
|
|
if (hdata==NULL) { /* if the handle was not saved by the previous handle */
|
2009-10-16 10:01:15 +00:00
|
|
|
hdata = initTransDataCurveHandles(td, bezt);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td++;
|
|
|
|
count++;
|
|
|
|
tail++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (propmode && head != tail) {
|
|
|
|
calc_distanceCurveVerts(head, tail-1);
|
|
|
|
head = tail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (propmode && head != tail)
|
|
|
|
calc_distanceCurveVerts(head, tail-1);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-16 10:01:15 +00:00
|
|
|
/* TODO - in the case of tilt and radius we can also avoid allocating the initTransDataCurveHandles
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* but for now just dont change handle types */
|
|
|
|
if (ELEM(t->mode, TFM_CURVE_SHRINKFATTEN, TFM_TILT) == 0)
|
|
|
|
testhandlesNurb(nu); /* sets the handles based on their selection, do this after the data is copied to the TransData */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
TransData *head, *tail;
|
|
|
|
head = tail = td;
|
|
|
|
for(a= nu->pntsu*nu->pntsv, bp= nu->bp; a>0; a--, bp++) {
|
|
|
|
if(bp->hide==0) {
|
|
|
|
if(propmode || (bp->f1 & SELECT)) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, bp->vec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= bp->vec;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bp->f1 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
|
|
|
td->ext = NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->mode==TFM_CURVE_SHRINKFATTEN || t->mode==TFM_RESIZE) {
|
|
|
|
td->val = &(bp->radius);
|
|
|
|
td->ival = bp->radius;
|
|
|
|
} else {
|
|
|
|
td->val = &(bp->alfa);
|
|
|
|
td->ival = bp->alfa;
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td++;
|
|
|
|
count++;
|
|
|
|
tail++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (propmode && head != tail) {
|
|
|
|
calc_distanceCurveVerts(head, tail-1);
|
|
|
|
head = tail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (propmode && head != tail)
|
|
|
|
calc_distanceCurveVerts(head, tail-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* lattice *************** */
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void createTransLatticeVerts(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2010-08-10 06:36:42 +00:00
|
|
|
Lattice *latt = ((Lattice*)t->obedit->data)->editlatt->latt;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td = NULL;
|
|
|
|
BPoint *bp;
|
|
|
|
float mtx[3][3], smtx[3][3];
|
|
|
|
int a;
|
|
|
|
int count=0, countsel=0;
|
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
|
|
|
|
2009-01-18 21:36:38 +00:00
|
|
|
bp = latt->def;
|
|
|
|
a = latt->pntsu * latt->pntsv * latt->pntsw;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
while(a--) {
|
|
|
|
if(bp->hide==0) {
|
|
|
|
if(bp->f1 & SELECT) countsel++;
|
|
|
|
if(propmode) count++;
|
|
|
|
}
|
|
|
|
bp++;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* note: in prop mode we need at least 1 selected */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (countsel==0) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
if(propmode) t->total = count;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else t->total = countsel;
|
|
|
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Lattice EditMode)");
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mtx, t->obedit->obmat);
|
|
|
|
invert_m3_m3(smtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td = t->data;
|
2009-01-18 21:36:38 +00:00
|
|
|
bp = latt->def;
|
|
|
|
a = latt->pntsu * latt->pntsv * latt->pntsw;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
while(a--) {
|
|
|
|
if(propmode || (bp->f1 & SELECT)) {
|
|
|
|
if(bp->hide==0) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, bp->vec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc= bp->vec;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(bp->f1 & SELECT) td->flag= TD_SELECTED;
|
|
|
|
else td->flag= 0;
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(td->smtx, smtx);
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->ext = NULL;
|
|
|
|
td->val = NULL;
|
|
|
|
|
|
|
|
td++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bp++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************* particle edit **************** */
|
|
|
|
static void createTransParticleVerts(bContext *C, TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td = NULL;
|
|
|
|
TransDataExtension *tx;
|
2009-02-25 19:29:58 +00:00
|
|
|
Base *base = CTX_data_active_base(C);
|
|
|
|
Object *ob = CTX_data_active_object(C);
|
2009-01-24 13:45:24 +00:00
|
|
|
ParticleEditSettings *pset = PE_settings(t->scene);
|
2009-08-29 15:20:36 +00:00
|
|
|
PTCacheEdit *edit = PE_get_current(t->scene, ob);
|
|
|
|
ParticleSystem *psys = NULL;
|
|
|
|
ParticleSystemModifierData *psmd = NULL;
|
|
|
|
PTCacheEditPoint *point;
|
|
|
|
PTCacheEditKey *key;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float mat[4][4];
|
2009-08-29 15:20:36 +00:00
|
|
|
int i,k, transformparticle;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int count = 0, hasselected = 0;
|
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
if(edit==NULL || t->settings->particle.selectmode==SCE_SELECT_PATH) return;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
psys = edit->psys;
|
|
|
|
|
|
|
|
if(psys)
|
|
|
|
psmd = psys_get_modifier(ob,psys);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
base->flag |= BA_HAS_RECALC_DATA;
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
|
|
|
|
point->flag &= ~PEP_TRANSFORM;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
transformparticle= 0;
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
if((point->flag & PEP_HIDE)==0) {
|
|
|
|
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if((key->flag&PEK_HIDE)==0) {
|
|
|
|
if(key->flag&PEK_SELECT) {
|
|
|
|
hasselected= 1;
|
|
|
|
transformparticle= 1;
|
|
|
|
}
|
|
|
|
else if(propmode)
|
|
|
|
transformparticle= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(transformparticle) {
|
2009-08-29 15:20:36 +00:00
|
|
|
count += point->totkey;
|
|
|
|
point->flag |= PEP_TRANSFORM;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* note: in prop mode we need at least 1 selected */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasselected==0) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->total = count;
|
|
|
|
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransObData(Particle Mode)");
|
|
|
|
|
|
|
|
if(t->mode == TFM_BAKE_TIME)
|
|
|
|
tx = t->ext = MEM_callocN(t->total * sizeof(TransDataExtension), "Particle_TransExtension");
|
|
|
|
else
|
|
|
|
tx = t->ext = NULL;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(ob->imat,ob->obmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
for(i=0, point=edit->points; i<edit->totpoint; i++, point++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *head, *tail;
|
|
|
|
head = tail = td;
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
if(!(point->flag & PEP_TRANSFORM)) continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-09-05 20:12:08 +00:00
|
|
|
if(psys && !(psys->flag & PSYS_GLOBAL_HAIR))
|
2009-08-29 15:20:36 +00:00
|
|
|
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
|
2009-09-05 20:12:08 +00:00
|
|
|
if(key->flag & PEK_USE_WCO) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(key->world_co, key->co);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(mat, key->world_co);
|
2009-08-29 15:20:36 +00:00
|
|
|
td->loc = key->world_co;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
td->loc = key->co;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
|
|
|
copy_v3_v3(td->center, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
if(key->flag & PEK_SELECT)
|
|
|
|
td->flag |= TD_SELECTED;
|
|
|
|
else if(!propmode)
|
|
|
|
td->flag |= TD_SKIP;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->mtx);
|
|
|
|
unit_m3(td->smtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* don't allow moving roots */
|
2009-09-05 20:12:08 +00:00
|
|
|
if(k==0 && pset->flag & PE_LOCK_FIRST && (!psys || !(psys->flag & PSYS_GLOBAL_HAIR)))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->protectflag |= OB_LOCK_LOC;
|
|
|
|
|
|
|
|
td->ob = ob;
|
|
|
|
td->ext = tx;
|
|
|
|
if(t->mode == TFM_BAKE_TIME) {
|
|
|
|
td->val = key->time;
|
|
|
|
td->ival = *(key->time);
|
|
|
|
/* abuse size and quat for min/max values */
|
|
|
|
td->flag |= TD_NO_EXT;
|
2011-03-03 17:59:04 +00:00
|
|
|
if(k==0) tx->size = NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else tx->size = (key - 1)->time;
|
|
|
|
|
2011-03-03 17:59:04 +00:00
|
|
|
if(k == point->totkey - 1) tx->quat = NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else tx->quat = (key + 1)->time;
|
|
|
|
}
|
|
|
|
|
|
|
|
td++;
|
|
|
|
if(tx)
|
|
|
|
tx++;
|
|
|
|
tail++;
|
|
|
|
}
|
|
|
|
if (propmode && head != tail)
|
|
|
|
calc_distanceCurveVerts(head, tail - 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void flushTransParticles(TransInfo *t)
|
|
|
|
{
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
Object *ob = OBACT;
|
2009-08-29 15:20:36 +00:00
|
|
|
PTCacheEdit *edit = PE_get_current(scene, ob);
|
|
|
|
ParticleSystem *psys = edit->psys;
|
2009-09-04 04:27:06 +00:00
|
|
|
ParticleSystemModifierData *psmd = NULL;
|
2009-08-29 15:20:36 +00:00
|
|
|
PTCacheEditPoint *point;
|
|
|
|
PTCacheEditKey *key;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td;
|
|
|
|
float mat[4][4], imat[4][4], co[3];
|
|
|
|
int i, k, propmode = t->flag & T_PROP_EDIT;
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
if(psys)
|
|
|
|
psmd = psys_get_modifier(ob, psys);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* we do transform in world space, so flush world space position
|
2009-08-29 15:20:36 +00:00
|
|
|
* back to particle local space (only for hair particles) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td= t->data;
|
2009-08-29 15:20:36 +00:00
|
|
|
for(i=0, point=edit->points; i<edit->totpoint; i++, point++, td++) {
|
|
|
|
if(!(point->flag & PEP_TRANSFORM)) continue;
|
|
|
|
|
2009-09-05 20:12:08 +00:00
|
|
|
if(psys && !(psys->flag & PSYS_GLOBAL_HAIR)) {
|
2009-08-29 15:20:36 +00:00
|
|
|
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles + i, mat);
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(imat,mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
for(k=0, key=point->keys; k<point->totkey; k++, key++) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(co, key->world_co);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(imat, co);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
2009-08-29 15:20:36 +00:00
|
|
|
/* optimization for proportional edit */
|
2009-11-10 20:43:45 +00:00
|
|
|
if(!propmode || !compare_v3v3(key->co, co, 0.0001f)) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(key->co, co);
|
2009-08-29 15:20:36 +00:00
|
|
|
point->flag |= PEP_EDIT_RECALC;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-29 15:20:36 +00:00
|
|
|
else
|
|
|
|
point->flag |= PEP_EDIT_RECALC;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2009-01-24 13:45:24 +00:00
|
|
|
PE_update_object(scene, OBACT, 1);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* mesh ****************** */
|
|
|
|
|
|
|
|
/* proportional distance based on connectivity */
|
2011-09-22 15:46:34 +00:00
|
|
|
#define THRESHOLDFACTOR (1.0f-0.0001f)
|
2010-02-01 21:31:32 +00:00
|
|
|
|
|
|
|
static int connectivity_edge(float mtx[][3], EditVert *v1, EditVert *v2)
|
|
|
|
{
|
|
|
|
float edge_vec[3];
|
|
|
|
float edge_len;
|
|
|
|
int done = 0;
|
|
|
|
|
2010-07-28 05:47:46 +00:00
|
|
|
/* note: hidden verts are not being checked for, this assumes
|
|
|
|
* flushing of hidden faces & edges is working right */
|
|
|
|
|
|
|
|
if (v1->f2 + v2->f2 == 4)
|
|
|
|
return 0;
|
|
|
|
|
2010-02-01 21:31:32 +00:00
|
|
|
sub_v3_v3v3(edge_vec, v1->co, v2->co);
|
|
|
|
mul_m3_v3(mtx, edge_vec);
|
|
|
|
|
|
|
|
edge_len = len_v3(edge_vec);
|
|
|
|
|
|
|
|
if (v1->f2) {
|
|
|
|
if (v2->f2) {
|
2011-09-22 15:46:34 +00:00
|
|
|
if (v2->tmp.fp + edge_len < THRESHOLDFACTOR * v1->tmp.fp) {
|
2010-02-01 21:31:32 +00:00
|
|
|
v1->tmp.fp = v2->tmp.fp + edge_len;
|
|
|
|
done = 1;
|
2011-09-22 15:46:34 +00:00
|
|
|
} else if (v1->tmp.fp + edge_len < THRESHOLDFACTOR * v2->tmp.fp) {
|
2010-02-01 21:31:32 +00:00
|
|
|
v2->tmp.fp = v1->tmp.fp + edge_len;
|
|
|
|
done = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
v2->f2 = 1;
|
|
|
|
v2->tmp.fp = v1->tmp.fp + edge_len;
|
|
|
|
done = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (v2->f2) {
|
|
|
|
v1->f2 = 1;
|
|
|
|
v1->tmp.fp = v2->tmp.fp + edge_len;
|
|
|
|
done = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return done;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void editmesh_set_connectivity_distance(EditMesh *em, float mtx[][3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
EditVert *eve;
|
|
|
|
EditEdge *eed;
|
2010-02-01 21:31:32 +00:00
|
|
|
EditFace *efa;
|
|
|
|
int done= 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* f2 flag is used for 'selection' */
|
|
|
|
/* tmp.l is offset on scratch array */
|
|
|
|
for(eve= em->verts.first; eve; eve= eve->next) {
|
|
|
|
if(eve->h==0) {
|
2010-02-01 21:31:32 +00:00
|
|
|
eve->tmp.fp = 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
if(eve->f & SELECT) {
|
|
|
|
eve->f2= 2;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
eve->f2 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Floodfill routine */
|
|
|
|
/*
|
2009-07-12 02:01:13 +00:00
|
|
|
At worst this is n*n of complexity where n is number of edges
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
Best case would be n if the list is ordered perfectly.
|
|
|
|
Estimate is n log n in average (so not too bad)
|
|
|
|
*/
|
|
|
|
while(done) {
|
|
|
|
done= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
if(eed->h==0) {
|
2010-02-01 21:31:32 +00:00
|
|
|
done |= connectivity_edge(mtx, eed->v1, eed->v2);
|
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2010-02-01 21:31:32 +00:00
|
|
|
/* do internal edges for quads */
|
|
|
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
2010-07-28 05:47:46 +00:00
|
|
|
if (efa->v4 && efa->h==0) {
|
2010-02-01 21:31:32 +00:00
|
|
|
done |= connectivity_edge(mtx, efa->v1, efa->v3);
|
|
|
|
done |= connectivity_edge(mtx, efa->v2, efa->v4);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* loop-in-a-loop I know, but we need it! (ton) */
|
2008-12-31 17:11:42 +00:00
|
|
|
static void get_face_center(float *cent, EditMesh *em, EditVert *eve)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
EditFace *efa;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(efa= em->faces.first; efa; efa= efa->next)
|
|
|
|
if(efa->f & SELECT)
|
|
|
|
if(efa->v1==eve || efa->v2==eve || efa->v3==eve || efa->v4==eve)
|
|
|
|
break;
|
|
|
|
if(efa) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(cent, efa->cent);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//way to overwrite what data is edited with transform
|
|
|
|
//static void VertsToTransData(TransData *td, EditVert *eve, BakeKey *key)
|
2008-12-31 22:43:29 +00:00
|
|
|
static void VertsToTransData(TransInfo *t, TransData *td, EditMesh *em, EditVert *eve)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
td->flag = 0;
|
|
|
|
//if(key)
|
|
|
|
// td->loc = key->co;
|
|
|
|
//else
|
|
|
|
td->loc = eve->co;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
2008-12-31 22:43:29 +00:00
|
|
|
if(t->around==V3D_LOCAL && (em->selectmode & SCE_SELECT_FACE))
|
2008-12-31 17:11:42 +00:00
|
|
|
get_face_center(td->center, em, eve);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
// Setting normals
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->axismtx[2], eve->no);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->axismtx[0][0] =
|
|
|
|
td->axismtx[0][1] =
|
|
|
|
td->axismtx[0][2] =
|
|
|
|
td->axismtx[1][0] =
|
|
|
|
td->axismtx[1][1] =
|
|
|
|
td->axismtx[1][2] = 0.0f;
|
|
|
|
|
|
|
|
td->ext = NULL;
|
|
|
|
td->val = NULL;
|
|
|
|
td->extra = NULL;
|
2008-12-31 22:43:29 +00:00
|
|
|
if (t->mode == TFM_BWEIGHT) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->val = &(eve->bweight);
|
|
|
|
td->ival = eve->bweight;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-16 18:04:03 +00:00
|
|
|
#if 0
|
2011-02-14 17:55:27 +00:00
|
|
|
static void createTransBMeshVerts(TransInfo *t, BME_Mesh *bm, BME_TransData_Head *td) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
BME_Vert *v;
|
|
|
|
BME_TransData *vtd;
|
|
|
|
TransData *tob;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
tob = t->data = MEM_callocN(td->len*sizeof(TransData), "TransObData(Bevel tool)");
|
|
|
|
|
|
|
|
for (i=0,v=bm->verts.first;v;v=v->next) {
|
|
|
|
if ( (vtd = BME_get_transdata(td,v)) ) {
|
|
|
|
tob->loc = vtd->loc;
|
|
|
|
tob->val = &vtd->factor;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(tob->iloc,vtd->co);
|
|
|
|
copy_v3_v3(tob->center,vtd->org);
|
|
|
|
copy_v3_v3(tob->axismtx[0],vtd->vec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tob->axismtx[1][0] = vtd->max ? *vtd->max : 0;
|
|
|
|
tob++;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* since td is a memarena, it can hold more transdata than actual elements
|
|
|
|
* (i.e. we can't depend on td->len to determine the number of actual elements) */
|
|
|
|
t->total = i;
|
|
|
|
}
|
2011-02-16 18:04:03 +00:00
|
|
|
#endif
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
static void createTransEditVerts(bContext *C, TransInfo *t)
|
|
|
|
{
|
2009-06-23 00:41:55 +00:00
|
|
|
ToolSettings *ts = CTX_data_tool_settings(C);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *tob = NULL;
|
2008-12-31 22:43:29 +00:00
|
|
|
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
EditVert *eve;
|
|
|
|
EditVert *eve_act = NULL;
|
2010-02-01 21:31:32 +00:00
|
|
|
float *mappedcos = NULL, *quats= NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float mtx[3][3], smtx[3][3], (*defmats)[3][3] = NULL, (*defcos)[3] = NULL;
|
|
|
|
int count=0, countsel=0, a, totleft;
|
2011-09-20 06:47:43 +00:00
|
|
|
int propmode = (t->flag & T_PROP_EDIT) ? (t->flag & (T_PROP_EDIT | T_PROP_CONNECTED)) : 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int mirror = 0;
|
2010-01-12 19:44:23 +00:00
|
|
|
short selectmode = ts->selectmode;
|
2009-03-06 15:50:15 +00:00
|
|
|
|
|
|
|
if (t->flag & T_MIRROR)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
mirror = 1;
|
|
|
|
}
|
|
|
|
|
2010-01-12 19:44:23 +00:00
|
|
|
/* edge slide forces edge select */
|
|
|
|
if (t->mode == TFM_EDGE_SLIDE) {
|
|
|
|
selectmode = SCE_SELECT_EDGE;
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
// transform now requires awareness for select mode, so we tag the f1 flags in verts
|
2010-01-12 19:44:23 +00:00
|
|
|
if(selectmode & SCE_SELECT_VERTEX) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(eve= em->verts.first; eve; eve= eve->next) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if(eve->h==0 && (eve->f & SELECT))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
eve->f1= SELECT;
|
|
|
|
else
|
|
|
|
eve->f1= 0;
|
|
|
|
}
|
|
|
|
}
|
2010-01-12 19:44:23 +00:00
|
|
|
else if(selectmode & SCE_SELECT_EDGE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
EditEdge *eed;
|
|
|
|
for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
|
|
|
|
for(eed= em->edges.first; eed; eed= eed->next) {
|
|
|
|
if(eed->h==0 && (eed->f & SELECT))
|
|
|
|
eed->v1->f1= eed->v2->f1= SELECT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
EditFace *efa;
|
|
|
|
for(eve= em->verts.first; eve; eve= eve->next) eve->f1= 0;
|
|
|
|
for(efa= em->faces.first; efa; efa= efa->next) {
|
|
|
|
if(efa->h==0 && (efa->f & SELECT)) {
|
|
|
|
efa->v1->f1= efa->v2->f1= efa->v3->f1= SELECT;
|
|
|
|
if(efa->v4) efa->v4->f1= SELECT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* now we can count */
|
|
|
|
for(eve= em->verts.first; eve; eve= eve->next) {
|
|
|
|
if(eve->h==0) {
|
|
|
|
if(eve->f1) countsel++;
|
|
|
|
if(propmode) count++;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* note: in prop mode we need at least 1 selected */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (countsel==0) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* check active */
|
2008-12-31 17:11:42 +00:00
|
|
|
if (em->selected.last) {
|
|
|
|
EditSelection *ese = em->selected.last;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if ( ese->type == EDITVERT ) {
|
|
|
|
eve_act = (EditVert *)ese->data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-01 21:31:32 +00:00
|
|
|
if(propmode) t->total = count;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else t->total = countsel;
|
2010-02-01 21:31:32 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tob= t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(Mesh EditMode)");
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mtx, t->obedit->obmat);
|
|
|
|
invert_m3_m3(smtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-09-20 06:47:43 +00:00
|
|
|
if(propmode & T_PROP_CONNECTED) {
|
|
|
|
editmesh_set_connectivity_distance(em, mtx);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* detect CrazySpace [tm] */
|
2011-03-06 17:03:25 +00:00
|
|
|
if(modifiers_getCageIndex(t->scene, t->obedit, NULL, 1)>=0) {
|
|
|
|
if(modifiers_isCorrectableDeformed(t->obedit)) {
|
|
|
|
/* check if we can use deform matrices for modifier from the
|
|
|
|
start up to stack, they are more accurate than quats */
|
|
|
|
totleft= editmesh_get_first_deform_matrices(t->scene, t->obedit, em, &defmats, &defcos);
|
|
|
|
|
|
|
|
/* if we still have more modifiers, also do crazyspace
|
|
|
|
correction with quats, relative to the coordinates after
|
|
|
|
the modifiers that support deform matrices (defcos) */
|
|
|
|
if(totleft > 0) {
|
|
|
|
mappedcos= crazyspace_get_mapped_editverts(t->scene, t->obedit);
|
|
|
|
quats= MEM_mallocN( (t->total)*sizeof(float)*4, "crazy quats");
|
|
|
|
crazyspace_set_quats_editmesh(em, (float*)defcos, mappedcos, quats);
|
|
|
|
if(mappedcos)
|
|
|
|
MEM_freeN(mappedcos);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2011-03-06 17:03:25 +00:00
|
|
|
|
|
|
|
if(defcos)
|
|
|
|
MEM_freeN(defcos);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* find out which half we do */
|
|
|
|
if(mirror) {
|
|
|
|
for (eve=em->verts.first; eve; eve=eve->next) {
|
|
|
|
if(eve->h==0 && eve->f1 && eve->co[0]!=0.0f) {
|
|
|
|
if(eve->co[0]<0.0f)
|
2009-10-15 21:54:22 +00:00
|
|
|
{
|
|
|
|
t->mirror = -1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
mirror = -1;
|
2009-10-15 21:54:22 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (a=0, eve=em->verts.first; eve; eve=eve->next, a++) {
|
|
|
|
if(eve->h==0) {
|
|
|
|
if(propmode || eve->f1) {
|
2008-12-31 22:43:29 +00:00
|
|
|
VertsToTransData(t, tob, em, eve);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* selected */
|
|
|
|
if(eve->f1) tob->flag |= TD_SELECTED;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* active */
|
|
|
|
if(eve == eve_act) tob->flag |= TD_ACTIVE;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(propmode) {
|
|
|
|
if (eve->f2) {
|
2010-02-01 21:31:32 +00:00
|
|
|
tob->dist= eve->tmp.fp;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
tob->flag |= TD_NOTCONNECTED;
|
|
|
|
tob->dist = MAXFLOAT;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* CrazySpace */
|
|
|
|
if(defmats || (quats && eve->tmp.p)) {
|
|
|
|
float mat[3][3], imat[3][3], qmat[3][3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* use both or either quat and defmat correction */
|
|
|
|
if(quats && eve->tmp.f) {
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_mat3( qmat,eve->tmp.p);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
if(defmats)
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m3(mat, mtx, qmat, defmats[a],
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, mtx, qmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, mtx, defmats[a]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m3_m3(imat, mat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(tob->smtx, imat);
|
|
|
|
copy_m3_m3(tob->mtx, mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(tob->smtx, smtx);
|
|
|
|
copy_m3_m3(tob->mtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Mirror? */
|
|
|
|
if( (mirror>0 && tob->iloc[0]>0.0f) || (mirror<0 && tob->iloc[0]<0.0f)) {
|
2010-02-17 19:50:42 +00:00
|
|
|
EditVert *vmir= editmesh_get_x_mirror_vert(t->obedit, em, eve, tob->iloc, a); /* initializes octree on first call */
|
|
|
|
if(vmir != eve) {
|
|
|
|
tob->extra = vmir;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
tob++;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-10-15 21:54:22 +00:00
|
|
|
|
|
|
|
if (mirror != 0)
|
|
|
|
{
|
|
|
|
tob = t->data;
|
|
|
|
for( a = 0; a < t->total; a++, tob++ )
|
|
|
|
{
|
|
|
|
if (ABS(tob->loc[0]) <= 0.00001f)
|
|
|
|
{
|
|
|
|
tob->flag |= TD_MIRROR_EDGE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* crazy space free */
|
|
|
|
if(quats)
|
|
|
|
MEM_freeN(quats);
|
|
|
|
if(defmats)
|
|
|
|
MEM_freeN(defmats);
|
|
|
|
}
|
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
/* *** NODE EDITOR *** */
|
|
|
|
void flushTransNodes(TransInfo *t)
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
TransData2D *td;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
/* flush to 2d vector from internally used 3d vector */
|
|
|
|
for(a=0, td= t->data2d; a<t->total; a++, td++) {
|
|
|
|
td->loc2d[0]= td->loc[0];
|
|
|
|
td->loc2d[1]= td->loc[1];
|
|
|
|
}
|
2011-07-22 15:28:50 +00:00
|
|
|
|
|
|
|
/* handle intersection with noodles */
|
|
|
|
if(t->total==1) {
|
|
|
|
ED_node_link_intersect_test(t->sa, 1);
|
|
|
|
}
|
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
}
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
/* *** SEQUENCE EDITOR *** */
|
2011-09-28 10:05:56 +00:00
|
|
|
|
|
|
|
/* commented _only_ because the meta may have animaion data which
|
|
|
|
* needs moving too [#28158] */
|
|
|
|
|
|
|
|
#define SEQ_TX_NESTED_METAS
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
void flushTransSeq(TransInfo *t)
|
|
|
|
{
|
2010-07-17 18:08:14 +00:00
|
|
|
ListBase *seqbasep= seq_give_editing(t->scene, FALSE)->seqbasep; /* Editing null check already done */
|
2010-10-18 10:52:57 +00:00
|
|
|
int a, new_frame, old_start;
|
2009-10-19 10:37:50 +00:00
|
|
|
TransData *td= NULL;
|
|
|
|
TransData2D *td2d= NULL;
|
2009-01-21 07:01:20 +00:00
|
|
|
TransDataSeq *tdsq= NULL;
|
|
|
|
Sequence *seq;
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
/* prevent updating the same seq twice
|
|
|
|
* if the transdata order is changed this will mess up
|
|
|
|
* but so will TransDataSeq */
|
|
|
|
Sequence *seq_prev= NULL;
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
/* flush to 2d vector from internally used 3d vector */
|
2009-10-19 10:37:50 +00:00
|
|
|
for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
|
2009-01-21 07:01:20 +00:00
|
|
|
tdsq= (TransDataSeq *)td->extra;
|
|
|
|
seq= tdsq->seq;
|
2010-10-18 10:52:57 +00:00
|
|
|
old_start = seq->start;
|
2009-10-27 02:54:25 +00:00
|
|
|
new_frame= (int)floor(td2d->loc[0] + 0.5f);
|
2009-01-21 07:01:20 +00:00
|
|
|
|
|
|
|
switch (tdsq->sel_flag) {
|
|
|
|
case SELECT:
|
2011-09-28 10:05:56 +00:00
|
|
|
#ifdef SEQ_TX_NESTED_METAS
|
|
|
|
if ((seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */
|
|
|
|
seq->start= new_frame - tdsq->start_offset;
|
|
|
|
#else
|
2009-12-21 16:57:39 +00:00
|
|
|
if (seq->type != SEQ_META && (seq->depth != 0 || seq_tx_test(seq))) /* for meta's, their children move */
|
|
|
|
seq->start= new_frame - tdsq->start_offset;
|
2011-09-28 10:05:56 +00:00
|
|
|
#endif
|
2009-01-23 23:14:02 +00:00
|
|
|
if (seq->depth==0) {
|
2009-10-27 02:54:25 +00:00
|
|
|
seq->machine= (int)floor(td2d->loc[1] + 0.5f);
|
2009-01-23 23:14:02 +00:00
|
|
|
CLAMP(seq->machine, 1, MAXSEQ);
|
|
|
|
}
|
2009-01-21 07:01:20 +00:00
|
|
|
break;
|
|
|
|
case SEQ_LEFTSEL: /* no vertical transform */
|
|
|
|
seq_tx_set_final_left(seq, new_frame);
|
2009-01-23 23:14:02 +00:00
|
|
|
seq_tx_handle_xlimits(seq, tdsq->flag&SEQ_LEFTSEL, tdsq->flag&SEQ_RIGHTSEL);
|
2009-12-15 11:27:46 +00:00
|
|
|
seq_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */
|
2009-01-21 07:01:20 +00:00
|
|
|
break;
|
|
|
|
case SEQ_RIGHTSEL: /* no vertical transform */
|
|
|
|
seq_tx_set_final_right(seq, new_frame);
|
2009-01-23 23:14:02 +00:00
|
|
|
seq_tx_handle_xlimits(seq, tdsq->flag&SEQ_LEFTSEL, tdsq->flag&SEQ_RIGHTSEL);
|
2009-12-15 11:27:46 +00:00
|
|
|
seq_single_fix(seq); /* todo - move this into aftertrans update? - old seq tx needed it anyway */
|
2009-01-21 07:01:20 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
if (seq != seq_prev) {
|
|
|
|
if(seq->depth==0) {
|
|
|
|
/* Calculate this strip and all nested strips
|
|
|
|
* children are ALWAYS transformed first
|
|
|
|
* so we dont need to do this in another loop. */
|
2010-02-07 23:41:17 +00:00
|
|
|
calc_sequence(t->scene, seq);
|
2009-10-19 10:37:50 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-02-07 23:41:17 +00:00
|
|
|
calc_sequence_disp(t->scene, seq);
|
2009-10-19 10:37:50 +00:00
|
|
|
}
|
2010-10-18 10:52:57 +00:00
|
|
|
|
|
|
|
if(tdsq->sel_flag == SELECT)
|
|
|
|
seq_offset_animdata(t->scene, seq, seq->start - old_start);
|
2009-10-19 10:37:50 +00:00
|
|
|
}
|
|
|
|
seq_prev= seq;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* need to do the overlap check in a new loop otherwise adjacent strips
|
|
|
|
* will not be updated and we'll get false positives */
|
|
|
|
seq_prev= NULL;
|
|
|
|
for(a=0, td= t->data, td2d= t->data2d; a<t->total; a++, td++, td2d++) {
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-19 10:37:50 +00:00
|
|
|
tdsq= (TransDataSeq *)td->extra;
|
|
|
|
seq= tdsq->seq;
|
|
|
|
|
|
|
|
if (seq != seq_prev) {
|
|
|
|
if(seq->depth==0) {
|
2009-01-25 14:53:41 +00:00
|
|
|
/* test overlap, displayes red outline */
|
|
|
|
seq->flag &= ~SEQ_OVERLAP;
|
|
|
|
if( seq_test_overlap(seqbasep, seq) ) {
|
|
|
|
seq->flag |= SEQ_OVERLAP;
|
|
|
|
}
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
seq_prev= seq;
|
2009-01-21 07:01:20 +00:00
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
|
2011-09-28 09:47:30 +00:00
|
|
|
if (t->mode == TFM_SEQ_SLIDE) { /* originally TFM_TIME_EXTEND, transform changes */
|
2009-01-24 05:38:25 +00:00
|
|
|
/* Special annoying case here, need to calc metas with TFM_TIME_EXTEND only */
|
2009-01-25 14:53:41 +00:00
|
|
|
seq= seqbasep->first;
|
2009-01-24 05:38:25 +00:00
|
|
|
|
|
|
|
while(seq) {
|
|
|
|
if (seq->type == SEQ_META && seq->flag & SELECT)
|
2010-02-07 23:41:17 +00:00
|
|
|
calc_sequence(t->scene, seq);
|
2009-01-24 05:38:25 +00:00
|
|
|
seq= seq->next;
|
|
|
|
}
|
|
|
|
}
|
2009-01-21 07:01:20 +00:00
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* ********************* UV ****************** */
|
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, float *uv, int selected)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
float aspx, aspy;
|
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_uv_aspect(sima, &aspx, &aspy);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* uv coords are scaled by aspects. this is needed for rotations and
|
|
|
|
proportional editing to be consistent with the stretchted uv coords
|
|
|
|
that are displayed. this also means that for display and numinput,
|
|
|
|
and when the the uv coords are flushed, these are converted each time */
|
|
|
|
td2d->loc[0] = uv[0]*aspx;
|
|
|
|
td2d->loc[1] = uv[1]*aspy;
|
|
|
|
td2d->loc[2] = 0.0f;
|
|
|
|
td2d->loc2d = uv;
|
|
|
|
|
|
|
|
td->flag = 0;
|
|
|
|
td->loc = td2d->loc;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
memset(td->axismtx, 0, sizeof(td->axismtx));
|
|
|
|
td->axismtx[2][2] = 1.0f;
|
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
td->ext= NULL; td->val= NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
if(selected) {
|
|
|
|
td->flag |= TD_SELECTED;
|
|
|
|
td->dist= 0.0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->dist= MAXFLOAT;
|
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->mtx);
|
|
|
|
unit_m3(td->smtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void createTransUVs(bContext *C, TransInfo *t)
|
|
|
|
{
|
2009-07-28 16:33:02 +00:00
|
|
|
SpaceImage *sima = CTX_wm_space_image(C);
|
2009-01-28 21:43:43 +00:00
|
|
|
Image *ima = CTX_data_edit_image(C);
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene = t->scene;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td = NULL;
|
|
|
|
TransData2D *td2d = NULL;
|
|
|
|
MTFace *tf;
|
|
|
|
int count=0, countsel=0;
|
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
|
|
|
|
2008-12-31 22:43:29 +00:00
|
|
|
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
EditFace *efa;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-12-20 05:26:25 +00:00
|
|
|
if(!ED_space_image_show_uvedit(sima, t->obedit)) return;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* count */
|
2009-01-28 21:43:43 +00:00
|
|
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
|
|
tf= CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
|
|
|
|
|
|
|
|
if(uvedit_face_visible(scene, ima, efa, tf)) {
|
|
|
|
efa->tmp.p = tf;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
if (uvedit_uv_selected(scene, efa, tf, 0)) countsel++;
|
|
|
|
if (uvedit_uv_selected(scene, efa, tf, 1)) countsel++;
|
|
|
|
if (uvedit_uv_selected(scene, efa, tf, 2)) countsel++;
|
2009-01-28 21:43:43 +00:00
|
|
|
if (efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) countsel++;
|
|
|
|
if(propmode)
|
|
|
|
count += (efa->v4)? 4: 3;
|
|
|
|
} else {
|
|
|
|
efa->tmp.p = NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* note: in prop mode we need at least 1 selected */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (countsel==0) return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->total= (propmode)? count: countsel;
|
|
|
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransObData(UV Editing)");
|
|
|
|
/* for each 2d uv coord a 3d vector is allocated, so that they can be
|
|
|
|
treated just as if they were 3d verts */
|
|
|
|
t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(UV Editing)");
|
|
|
|
|
2009-01-18 21:36:38 +00:00
|
|
|
if(sima->flag & SI_CLIP_UV)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_CLIP_UV;
|
|
|
|
|
|
|
|
td= t->data;
|
|
|
|
td2d= t->data2d;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
for (efa= em->faces.first; efa; efa= efa->next) {
|
|
|
|
if ((tf=(MTFace *)efa->tmp.p)) {
|
|
|
|
if (propmode) {
|
|
|
|
UVsToTransData(sima, td++, td2d++, tf->uv[0], uvedit_uv_selected(scene, efa, tf, 0));
|
|
|
|
UVsToTransData(sima, td++, td2d++, tf->uv[1], uvedit_uv_selected(scene, efa, tf, 1));
|
|
|
|
UVsToTransData(sima, td++, td2d++, tf->uv[2], uvedit_uv_selected(scene, efa, tf, 2));
|
|
|
|
if(efa->v4)
|
|
|
|
UVsToTransData(sima, td++, td2d++, tf->uv[3], uvedit_uv_selected(scene, efa, tf, 3));
|
|
|
|
} else {
|
|
|
|
if(uvedit_uv_selected(scene, efa, tf, 0)) UVsToTransData(sima, td++, td2d++, tf->uv[0], 1);
|
|
|
|
if(uvedit_uv_selected(scene, efa, tf, 1)) UVsToTransData(sima, td++, td2d++, tf->uv[1], 1);
|
|
|
|
if(uvedit_uv_selected(scene, efa, tf, 2)) UVsToTransData(sima, td++, td2d++, tf->uv[2], 1);
|
|
|
|
if(efa->v4 && uvedit_uv_selected(scene, efa, tf, 3)) UVsToTransData(sima, td++, td2d++, tf->uv[3], 1);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-18 21:36:38 +00:00
|
|
|
if (sima->flag & SI_LIVE_UNWRAP)
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_uvedit_live_unwrap_begin(t->scene, t->obedit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void flushTransUVs(TransInfo *t)
|
|
|
|
{
|
2009-01-28 21:43:43 +00:00
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData2D *td;
|
|
|
|
int a, width, height;
|
|
|
|
float aspx, aspy, invx, invy;
|
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_uv_aspect(sima, &aspx, &aspy);
|
|
|
|
ED_space_image_size(sima, &width, &height);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
invx= 1.0f/aspx;
|
|
|
|
invy= 1.0f/aspy;
|
|
|
|
|
|
|
|
/* flush to 2d vector from internally used 3d vector */
|
|
|
|
for(a=0, td= t->data2d; a<t->total; a++, td++) {
|
|
|
|
td->loc2d[0]= td->loc[0]*invx;
|
|
|
|
td->loc2d[1]= td->loc[1]*invy;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
if((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->loc2d[0]= (float)floor(width*td->loc2d[0] + 0.5f)/width;
|
|
|
|
td->loc2d[1]= (float)floor(height*td->loc2d[1] + 0.5f)/height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int clipUVTransform(TransInfo *t, float *vec, int resize)
|
|
|
|
{
|
|
|
|
TransData *td;
|
|
|
|
int a, clipx=1, clipy=1;
|
|
|
|
float aspx, aspy, min[2], max[2];
|
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
min[0]= min[1]= 0.0f;
|
|
|
|
max[0]= aspx; max[1]= aspy;
|
|
|
|
|
|
|
|
for(a=0, td= t->data; a<t->total; a++, td++) {
|
|
|
|
DO_MINMAX2(td->loc, min, max);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(resize) {
|
|
|
|
if(min[0] < 0.0f && t->center[0] > 0.0f && t->center[0] < aspx*0.5f)
|
|
|
|
vec[0] *= t->center[0]/(t->center[0] - min[0]);
|
|
|
|
else if(max[0] > aspx && t->center[0] < aspx)
|
|
|
|
vec[0] *= (t->center[0] - aspx)/(t->center[0] - max[0]);
|
|
|
|
else
|
|
|
|
clipx= 0;
|
|
|
|
|
|
|
|
if(min[1] < 0.0f && t->center[1] > 0.0f && t->center[1] < aspy*0.5f)
|
|
|
|
vec[1] *= t->center[1]/(t->center[1] - min[1]);
|
|
|
|
else if(max[1] > aspy && t->center[1] < aspy)
|
|
|
|
vec[1] *= (t->center[1] - aspy)/(t->center[1] - max[1]);
|
|
|
|
else
|
|
|
|
clipy= 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(min[0] < 0.0f)
|
|
|
|
vec[0] -= min[0];
|
|
|
|
else if(max[0] > aspx)
|
|
|
|
vec[0] -= max[0]-aspx;
|
|
|
|
else
|
|
|
|
clipx= 0;
|
|
|
|
|
|
|
|
if(min[1] < 0.0f)
|
|
|
|
vec[1] -= min[1];
|
|
|
|
else if(max[1] > aspy)
|
|
|
|
vec[1] -= max[1]-aspy;
|
|
|
|
else
|
|
|
|
clipy= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
return (clipx || clipy);
|
|
|
|
}
|
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* ********************* ANIMATION EDITORS (GENERAL) ************************* */
|
|
|
|
|
|
|
|
/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */
|
|
|
|
static short FrameOnMouseSide(char side, float frame, float cframe)
|
|
|
|
{
|
|
|
|
/* both sides, so it doesn't matter */
|
|
|
|
if (side == 'B') return 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* only on the named side */
|
|
|
|
if (side == 'R')
|
|
|
|
return (frame >= cframe) ? 1 : 0;
|
|
|
|
else
|
|
|
|
return (frame <= cframe) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* NLA EDITOR ************************* */
|
|
|
|
|
|
|
|
static void createTransNlaData(bContext *C, TransInfo *t)
|
|
|
|
{
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene= t->scene;
|
2011-07-06 01:34:10 +00:00
|
|
|
SpaceNla *snla = NULL;
|
2009-06-09 11:26:45 +00:00
|
|
|
TransData *td = NULL;
|
|
|
|
TransDataNla *tdn = NULL;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
bAnimContext ac;
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int filter;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
int count=0;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* determine what type of data we are operating on */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
|
|
|
return;
|
2011-07-06 01:34:10 +00:00
|
|
|
snla = (SpaceNla *)ac.sl;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* filter data */
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT);
|
2009-06-09 11:26:45 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* which side of the current frame should be allowed */
|
|
|
|
if (t->mode == TFM_TIME_EXTEND) {
|
|
|
|
/* only side on which mouse is gets transformed */
|
|
|
|
float xmouse, ymouse;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
|
2010-03-26 00:25:14 +00:00
|
|
|
t->frame_side= (xmouse > CFRA) ? 'R' : 'L';
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* normal transform - both sides of current frame are considered */
|
2010-03-08 09:06:58 +00:00
|
|
|
t->frame_side = 'B';
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* loop 1: count how many strips are selected (consider each strip as 2 points) */
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-09 12:28:10 +00:00
|
|
|
NlaTrack *nlt= (NlaTrack *)ale->data;
|
|
|
|
NlaStrip *strip;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 02:12:50 +00:00
|
|
|
/* make some meta-strips for chains of selected strips */
|
|
|
|
BKE_nlastrips_make_metas(&nlt->strips, 1);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 12:28:10 +00:00
|
|
|
/* only consider selected strips */
|
|
|
|
for (strip= nlt->strips.first; strip; strip= strip->next) {
|
|
|
|
// TODO: we can make strips have handles later on...
|
2009-06-25 12:30:49 +00:00
|
|
|
/* transition strips can't get directly transformed */
|
|
|
|
if (strip->type != NLASTRIP_TYPE_TRANSITION) {
|
|
|
|
if (strip->flag & NLASTRIP_FLAG_SELECT) {
|
2010-03-08 09:06:58 +00:00
|
|
|
if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA)) count++;
|
|
|
|
if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA)) count++;
|
2009-06-25 12:30:49 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* stop if trying to build list if nothing selected */
|
|
|
|
if (count == 0) {
|
|
|
|
/* cleanup temp list */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
return;
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* allocate memory for data */
|
|
|
|
t->total= count;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(NLA Editor)");
|
|
|
|
td= t->data;
|
|
|
|
t->customData= MEM_callocN(t->total*sizeof(TransDataNla), "TransDataNla (NLA Editor)");
|
|
|
|
tdn= t->customData;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* loop 2: build transdata array */
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
|
|
|
/* only if a real NLA-track */
|
|
|
|
if (ale->type == ANIMTYPE_NLATRACK) {
|
2010-11-11 10:27:24 +00:00
|
|
|
AnimData *adt = ale->adt;
|
2009-06-09 11:26:45 +00:00
|
|
|
NlaTrack *nlt= (NlaTrack *)ale->data;
|
|
|
|
NlaStrip *strip;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* only consider selected strips */
|
|
|
|
for (strip= nlt->strips.first; strip; strip= strip->next) {
|
|
|
|
// TODO: we can make strips have handles later on...
|
2009-06-25 12:30:49 +00:00
|
|
|
/* transition strips can't get directly transformed */
|
|
|
|
if (strip->type != NLASTRIP_TYPE_TRANSITION) {
|
|
|
|
if (strip->flag & NLASTRIP_FLAG_SELECT) {
|
2009-07-07 05:41:59 +00:00
|
|
|
/* our transform data is constructed as follows:
|
|
|
|
* - only the handles on the right side of the current-frame get included
|
|
|
|
* - td structs are transform-elements operated on by the transform system
|
|
|
|
* and represent a single handle. The storage/pointer used (val or loc) depends on
|
|
|
|
* whether we're scaling or transforming. Ultimately though, the handles
|
|
|
|
* the td writes to will simply be a dummy in tdn
|
|
|
|
* - for each strip being transformed, a single tdn struct is used, so in some
|
|
|
|
* cases, there will need to be 1 of these tdn elements in the array skipped...
|
|
|
|
*/
|
|
|
|
float center[3], yval;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* firstly, init tdn settings */
|
2009-07-12 03:42:39 +00:00
|
|
|
tdn->id= ale->id;
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->oldTrack= tdn->nlt= nlt;
|
|
|
|
tdn->strip= strip;
|
2010-11-11 10:27:24 +00:00
|
|
|
tdn->trackIndex= BLI_findindex(&adt->nla_tracks, nlt);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-07-06 01:34:10 +00:00
|
|
|
yval= (float)(tdn->trackIndex * NLACHANNEL_STEP(snla));
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->h1[0]= strip->start;
|
|
|
|
tdn->h1[1]= yval;
|
|
|
|
tdn->h2[0]= strip->end;
|
|
|
|
tdn->h2[1]= yval;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
center[0]= (float)CFRA;
|
|
|
|
center[1]= yval;
|
|
|
|
center[2]= 0.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* set td's based on which handles are applicable */
|
2010-03-08 09:06:58 +00:00
|
|
|
if (FrameOnMouseSide(t->frame_side, strip->start, (float)CFRA))
|
2009-06-25 12:30:49 +00:00
|
|
|
{
|
2009-07-07 05:41:59 +00:00
|
|
|
/* just set tdn to assume that it only has one handle for now */
|
|
|
|
tdn->handle= -1;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-25 12:30:49 +00:00
|
|
|
/* now, link the transform data up to this data */
|
2010-03-26 00:25:14 +00:00
|
|
|
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
|
2009-07-07 05:41:59 +00:00
|
|
|
td->loc= tdn->h1;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, tdn->h1);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* store all the other gunk that is required by transform */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, center);
|
2009-07-07 05:41:59 +00:00
|
|
|
memset(td->axismtx, 0, sizeof(td->axismtx));
|
|
|
|
td->axismtx[2][2] = 1.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
td->ext= NULL; td->val= NULL;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
td->flag |= TD_SELECTED;
|
|
|
|
td->dist= 0.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->mtx);
|
|
|
|
unit_m3(td->smtx);
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-04-05 11:04:00 +00:00
|
|
|
/* time scaling only needs single value */
|
2009-07-07 05:41:59 +00:00
|
|
|
td->val= &tdn->h1[0];
|
|
|
|
td->ival= tdn->h1[0];
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-25 12:30:49 +00:00
|
|
|
td->extra= tdn;
|
|
|
|
td++;
|
|
|
|
}
|
2010-03-08 09:06:58 +00:00
|
|
|
if (FrameOnMouseSide(t->frame_side, strip->end, (float)CFRA))
|
2009-07-12 02:01:13 +00:00
|
|
|
{
|
2009-07-07 05:41:59 +00:00
|
|
|
/* if tdn is already holding the start handle, then we're doing both, otherwise, only end */
|
|
|
|
tdn->handle= (tdn->handle) ? 2 : 1;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-25 12:30:49 +00:00
|
|
|
/* now, link the transform data up to this data */
|
2010-03-26 00:25:14 +00:00
|
|
|
if (ELEM(t->mode, TFM_TRANSLATION, TFM_TIME_EXTEND)) {
|
2009-07-07 05:41:59 +00:00
|
|
|
td->loc= tdn->h2;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, tdn->h2);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* store all the other gunk that is required by transform */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, center);
|
2009-07-07 05:41:59 +00:00
|
|
|
memset(td->axismtx, 0, sizeof(td->axismtx));
|
|
|
|
td->axismtx[2][2] = 1.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
td->ext= NULL; td->val= NULL;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
td->flag |= TD_SELECTED;
|
|
|
|
td->dist= 0.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->mtx);
|
|
|
|
unit_m3(td->smtx);
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-04-05 11:04:00 +00:00
|
|
|
/* time scaling only needs single value */
|
2009-07-07 05:41:59 +00:00
|
|
|
td->val= &tdn->h2[0];
|
|
|
|
td->ival= tdn->h2[0];
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-25 12:30:49 +00:00
|
|
|
td->extra= tdn;
|
|
|
|
td++;
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* if both handles were used, skip the next tdn (i.e. leave it blank) since the counting code is dumb...
|
2009-07-07 05:41:59 +00:00
|
|
|
* otherwise, just advance to the next one...
|
|
|
|
*/
|
|
|
|
if (tdn->handle == 2)
|
|
|
|
tdn += 2;
|
|
|
|
else
|
|
|
|
tdn++;
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-04-05 11:04:00 +00:00
|
|
|
|
2009-06-09 11:26:45 +00:00
|
|
|
/* cleanup temp list */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ********************* ACTION EDITOR ****************** */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* Called by special_aftertrans_update to make sure selected gp-frames replace
|
|
|
|
* any other gp-frames which may reside on that frame (that are not selected).
|
|
|
|
* It also makes sure gp-frames are still stored in chronological order after
|
|
|
|
* transform.
|
|
|
|
*/
|
|
|
|
static void posttrans_gpd_clean (bGPdata *gpd)
|
|
|
|
{
|
|
|
|
bGPDlayer *gpl;
|
2011-07-05 01:54:01 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (gpl= gpd->layers.first; gpl; gpl= gpl->next) {
|
|
|
|
ListBase sel_buffer = {NULL, NULL};
|
|
|
|
bGPDframe *gpf, *gpfn;
|
|
|
|
bGPDframe *gfs, *gfsn;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* loop 1: loop through and isolate selected gp-frames to buffer
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* (these need to be sorted as they are isolated)
|
|
|
|
*/
|
|
|
|
for (gpf= gpl->frames.first; gpf; gpf= gpfn) {
|
|
|
|
short added= 0;
|
|
|
|
gpfn= gpf->next;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (gpf->flag & GP_FRAME_SELECT) {
|
|
|
|
BLI_remlink(&gpl->frames, gpf);
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* find place to add them in buffer
|
|
|
|
* - go backwards as most frames will still be in order,
|
2009-07-12 02:01:13 +00:00
|
|
|
* so doing it this way will be faster
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
|
|
|
for (gfs= sel_buffer.last; gfs; gfs= gfs->prev) {
|
|
|
|
/* if current (gpf) occurs after this one in buffer, add! */
|
|
|
|
if (gfs->framenum < gpf->framenum) {
|
|
|
|
BLI_insertlinkafter(&sel_buffer, gfs, gpf);
|
|
|
|
added= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (added == 0)
|
|
|
|
BLI_addhead(&sel_buffer, gpf);
|
|
|
|
}
|
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* error checking: it is unlikely, but may be possible to have none selected */
|
|
|
|
if (sel_buffer.first == NULL)
|
|
|
|
continue;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if all were selected (i.e. gpl->frames is empty), then just transfer sel-buf over */
|
|
|
|
if (gpl->frames.first == NULL) {
|
|
|
|
gpl->frames.first= sel_buffer.first;
|
|
|
|
gpl->frames.last= sel_buffer.last;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
continue;
|
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* loop 2: remove duplicates of frames in buffers */
|
|
|
|
for (gpf= gpl->frames.first; gpf && sel_buffer.first; gpf= gpfn) {
|
|
|
|
gpfn= gpf->next;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* loop through sel_buffer, emptying stuff from front of buffer if ok */
|
|
|
|
for (gfs= sel_buffer.first; gfs && gpf; gfs= gfsn) {
|
|
|
|
gfsn= gfs->next;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if this buffer frame needs to go before current, add it! */
|
|
|
|
if (gfs->framenum < gpf->framenum) {
|
|
|
|
/* transfer buffer frame to frames list (before current) */
|
|
|
|
BLI_remlink(&sel_buffer, gfs);
|
|
|
|
BLI_insertlinkbefore(&gpl->frames, gpf, gfs);
|
|
|
|
}
|
|
|
|
/* if this buffer frame is on same frame, replace current with it and stop */
|
|
|
|
else if (gfs->framenum == gpf->framenum) {
|
|
|
|
/* transfer buffer frame to frames list (before current) */
|
|
|
|
BLI_remlink(&sel_buffer, gfs);
|
|
|
|
BLI_insertlinkbefore(&gpl->frames, gpf, gfs);
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* get rid of current frame */
|
2011-01-10 22:10:28 +00:00
|
|
|
gpencil_layer_delframe(gpl, gpf);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if anything is still in buffer, append to end */
|
|
|
|
for (gfs= sel_buffer.first; gfs; gfs= gfsn) {
|
|
|
|
gfsn= gfs->next;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
BLI_remlink(&sel_buffer, gfs);
|
|
|
|
BLI_addtail(&gpl->frames, gfs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
/* Called during special_aftertrans_update to make sure selected keyframes replace
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* any other keyframes which may reside on that frame (that is not selected).
|
|
|
|
*/
|
2011-09-29 05:03:21 +00:00
|
|
|
static void posttrans_fcurve_clean (FCurve *fcu, const short use_handle)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-12-06 09:37:31 +00:00
|
|
|
float *selcache; /* cache for frame numbers of selected frames (fcu->totvert*sizeof(float)) */
|
2009-01-03 06:01:11 +00:00
|
|
|
int len, index, i; /* number of frames in cache, item index */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
/* allocate memory for the cache */
|
2009-12-06 09:37:31 +00:00
|
|
|
// TODO: investigate using BezTriple columns instead?
|
2010-03-03 13:20:18 +00:00
|
|
|
if (fcu->totvert == 0 || fcu->bezt==NULL)
|
2009-01-03 06:01:11 +00:00
|
|
|
return;
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
selcache= MEM_callocN(sizeof(float)*fcu->totvert, "FCurveSelFrameNums");
|
2009-01-03 06:01:11 +00:00
|
|
|
len= 0;
|
|
|
|
index= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
/* We do 2 loops, 1 for marking keyframes for deletion, one for deleting
|
|
|
|
* as there is no guarantee what order the keyframes are exactly, even though
|
2009-01-03 06:01:11 +00:00
|
|
|
* they have been sorted by time.
|
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
/* Loop 1: find selected keyframes */
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
for (i = 0; i < fcu->totvert; i++) {
|
|
|
|
BezTriple *bezt= &fcu->bezt[i];
|
2009-10-14 02:18:59 +00:00
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
if (BEZSELECTED(bezt)) {
|
|
|
|
selcache[index]= bezt->vec[1][0];
|
|
|
|
index++;
|
|
|
|
len++;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-14 02:18:59 +00:00
|
|
|
/* Loop 2: delete unselected keyframes on the same frames
|
|
|
|
* (if any keyframes were found, or the whole curve wasn't affected)
|
|
|
|
*/
|
|
|
|
if ((len) && (len != fcu->totvert)) {
|
2010-06-17 19:33:27 +00:00
|
|
|
for (i= fcu->totvert-1; i >= 0; i--) {
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
BezTriple *bezt= &fcu->bezt[i];
|
2009-10-14 02:18:59 +00:00
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
if (BEZSELECTED(bezt) == 0) {
|
|
|
|
/* check beztriple should be removed according to cache */
|
|
|
|
for (index= 0; index < len; index++) {
|
2011-03-28 17:06:15 +00:00
|
|
|
if (IS_EQF(bezt->vec[1][0], selcache[index])) {
|
2009-10-14 02:18:59 +00:00
|
|
|
delete_fcurve_key(fcu, i, 0);
|
2009-01-03 06:01:11 +00:00
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2010-06-17 19:33:27 +00:00
|
|
|
else if (bezt->vec[1][0] < selcache[index])
|
2009-01-03 06:01:11 +00:00
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-14 02:18:59 +00:00
|
|
|
|
2011-09-29 05:03:21 +00:00
|
|
|
testhandles_fcurve(fcu, use_handle);
|
2009-01-03 06:01:11 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
/* free cache */
|
|
|
|
MEM_freeN(selcache);
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-07-08 15:01:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Called by special_aftertrans_update to make sure selected keyframes replace
|
|
|
|
* any other keyframes which may reside on that frame (that is not selected).
|
2009-07-12 02:01:13 +00:00
|
|
|
* remake_action_ipos should have already been called
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2008-12-29 06:06:59 +00:00
|
|
|
static void posttrans_action_clean (bAnimContext *ac, bAction *act)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2008-12-29 06:06:59 +00:00
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int filter;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* filter data */
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
|
2009-01-26 04:13:38 +00:00
|
|
|
ANIM_animdata_filter(ac, &anim_data, filter, act, ANIMCONT_ACTION);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-12-06 09:37:31 +00:00
|
|
|
/* loop through relevant data, removing keyframes as appropriate
|
2009-07-12 02:01:13 +00:00
|
|
|
* - all keyframes are converted in/out of global time
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2008-12-29 06:06:59 +00:00
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(ac, ale);
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt) {
|
2010-01-15 10:34:39 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
|
2011-09-29 05:03:21 +00:00
|
|
|
posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */
|
2010-01-15 10:34:39 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2011-09-29 05:03:21 +00:00
|
|
|
posttrans_fcurve_clean(ale->key_data, FALSE); /* only use handles in graph editor */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* free temp data */
|
2008-12-29 06:06:59 +00:00
|
|
|
BLI_freelistN(&anim_data);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------------------- */
|
|
|
|
|
|
|
|
/* fully select selected beztriples, but only include if it's on the right side of cfra */
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
static int count_fcurve_keys(FCurve *fcu, char side, float cfra)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
BezTriple *bezt;
|
|
|
|
int i, count = 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-03-02 00:55:10 +00:00
|
|
|
if (ELEM(NULL, fcu, fcu->bezt))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return count;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only include points that occur on the right side of cfra */
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
2009-01-03 06:01:11 +00:00
|
|
|
if (bezt->f2 & SELECT) {
|
2011-09-29 06:13:25 +00:00
|
|
|
/* no need to adjust the handle selection since they are assumed
|
|
|
|
* selected (like graph editor with SIPO_NOHANDLES) */
|
|
|
|
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
|
2010-05-06 19:54:43 +00:00
|
|
|
count += 1;
|
2011-09-29 06:13:25 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fully select selected beztriples, but only include if it's on the right side of cfra */
|
|
|
|
static int count_gplayer_frames(bGPDlayer *gpl, char side, float cfra)
|
|
|
|
{
|
|
|
|
bGPDframe *gpf;
|
|
|
|
int count = 0;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (gpl == NULL)
|
|
|
|
return count;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only include points that occur on the right side of cfra */
|
|
|
|
for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
|
|
|
|
if (gpf->flag & GP_FRAME_SELECT) {
|
|
|
|
if (FrameOnMouseSide(side, (float)gpf->framenum, cfra))
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function assigns the information to transdata */
|
2009-06-23 13:25:31 +00:00
|
|
|
static void TimeToTransData(TransData *td, float *time, AnimData *adt)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
/* memory is calloc'ed, so that should zero everything nicely for us */
|
|
|
|
td->val = time;
|
|
|
|
td->ival = *(time);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
/* store the AnimData where this keyframe exists as a keyframe of the
|
|
|
|
* active action as td->extra.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2009-06-23 13:25:31 +00:00
|
|
|
td->extra= adt;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function advances the address to which td points to, so it must return
|
|
|
|
* the new address so that the next time new transform data is added, it doesn't
|
2009-01-03 06:01:11 +00:00
|
|
|
* overwrite the existing ones... i.e. td = IcuToTransData(td, icu, ob, side, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
|
|
|
* The 'side' argument is needed for the extend mode. 'B' = both sides, 'R'/'L' mean only data
|
2009-07-12 02:01:13 +00:00
|
|
|
* on the named side are used.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2010-05-06 19:54:43 +00:00
|
|
|
static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FCurve *fcu, AnimData *adt, char side, float cfra)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
BezTriple *bezt;
|
2010-05-06 19:54:43 +00:00
|
|
|
TransData2D *td2d = *td2dv;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int i;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-10-20 05:18:02 +00:00
|
|
|
if (ELEM(NULL, fcu, fcu->bezt))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return td;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
2009-01-03 06:01:11 +00:00
|
|
|
/* only add selected keyframes (for now, proportional edit is not enabled) */
|
2010-07-26 19:48:35 +00:00
|
|
|
if (bezt->f2 & SELECT) { /* note this MUST match count_fcurve_keys(), so can't use BEZSELECTED() macro */
|
2009-01-03 06:01:11 +00:00
|
|
|
/* only add if on the right 'side' of the current frame */
|
|
|
|
if (FrameOnMouseSide(side, bezt->vec[1][0], cfra)) {
|
2009-06-23 13:25:31 +00:00
|
|
|
TimeToTransData(td, bezt->vec[1], adt);
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
/*set flags to move handles as necassary*/
|
|
|
|
td->flag |= TD_MOVEHANDLE1|TD_MOVEHANDLE2;
|
|
|
|
td2d->h1 = bezt->vec[0];
|
|
|
|
td2d->h2 = bezt->vec[2];
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
VECCOPY2D(td2d->ih1, td2d->h1);
|
|
|
|
VECCOPY2D(td2d->ih2, td2d->h2);
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2009-01-03 06:01:11 +00:00
|
|
|
td++;
|
2010-05-06 19:54:43 +00:00
|
|
|
td2d++;
|
2009-01-03 06:01:11 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
*td2dv = td2d;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return td;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* helper struct for gp-frame transforms (only used here) */
|
|
|
|
typedef struct tGPFtransdata {
|
|
|
|
float val; /* where transdata writes transform */
|
|
|
|
int *sdata; /* pointer to gpf->framenum */
|
|
|
|
} tGPFtransdata;
|
|
|
|
|
|
|
|
/* This function helps flush transdata written to tempdata into the gp-frames */
|
|
|
|
void flushTransGPactionData (TransInfo *t)
|
|
|
|
{
|
|
|
|
tGPFtransdata *tfd;
|
|
|
|
int i;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* find the first one to start from */
|
|
|
|
if (t->mode == TFM_TIME_SLIDE)
|
|
|
|
tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
|
|
|
|
else
|
|
|
|
tfd= (tGPFtransdata *)(t->customData);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* flush data! */
|
|
|
|
for (i = 0; i < t->total; i++, tfd++) {
|
2011-03-28 17:06:15 +00:00
|
|
|
*(tfd->sdata)= (int)floor(tfd->val + 0.5f);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* This function advances the address to which td points to, so it must return
|
|
|
|
* the new address so that the next time new transform data is added, it doesn't
|
|
|
|
* overwrite the existing ones... i.e. td = GPLayerToTransData(td, ipo, ob, side, cfra);
|
|
|
|
*
|
|
|
|
* The 'side' argument is needed for the extend mode. 'B' = both sides, 'R'/'L' mean only data
|
2009-07-12 02:01:13 +00:00
|
|
|
* on the named side are used.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
|
|
|
static int GPLayerToTransData (TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl, char side, float cfra)
|
|
|
|
{
|
|
|
|
bGPDframe *gpf;
|
|
|
|
int count= 0;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* check for select frames on right side of current frame */
|
|
|
|
for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
|
|
|
|
if (gpf->flag & GP_FRAME_SELECT) {
|
|
|
|
if (FrameOnMouseSide(side, (float)gpf->framenum, cfra)) {
|
|
|
|
/* memory is calloc'ed, so that should zero everything nicely for us */
|
|
|
|
td->val= &tfd->val;
|
|
|
|
td->ival= (float)gpf->framenum;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tfd->val= (float)gpf->framenum;
|
|
|
|
tfd->sdata= &gpf->framenum;
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* advance td now */
|
|
|
|
td++;
|
|
|
|
tfd++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void createTransActionData(bContext *C, TransInfo *t)
|
|
|
|
{
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene= t->scene;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransData *td = NULL;
|
2010-05-06 19:54:43 +00:00
|
|
|
TransData2D *td2d = NULL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
tGPFtransdata *tfd = NULL;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
bAnimContext ac;
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int filter;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int count=0;
|
|
|
|
float cfra;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* determine what type of data we are operating on */
|
2008-12-29 06:06:59 +00:00
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
|
|
|
return;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* filter data */
|
2008-12-29 06:06:59 +00:00
|
|
|
if (ac.datatype == ANIMCONT_GPENCIL)
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
|
2009-01-26 04:13:38 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* which side of the current frame should be allowed */
|
|
|
|
if (t->mode == TFM_TIME_EXTEND) {
|
|
|
|
/* only side on which mouse is gets transformed */
|
|
|
|
float xmouse, ymouse;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
|
2010-03-08 09:06:58 +00:00
|
|
|
t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* normal transform - both sides of current frame are considered */
|
2010-03-08 09:06:58 +00:00
|
|
|
t->frame_side = 'B';
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* loop 1: fully select ipo-keys and count how many BezTriples are selected */
|
2008-12-29 06:06:59 +00:00
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
/* convert current-frame to action-time (slightly less accurate, espcially under
|
2009-07-12 02:01:13 +00:00
|
|
|
* higher scaling ratios, but is faster than converting all points)
|
2008-12-29 06:06:59 +00:00
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2008-12-29 06:06:59 +00:00
|
|
|
cfra = (float)CFRA;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
if (ale->type == ANIMTYPE_FCURVE)
|
2010-03-08 09:06:58 +00:00
|
|
|
count += count_fcurve_keys(ale->key_data, t->frame_side, cfra);
|
2011-01-10 22:10:28 +00:00
|
|
|
else
|
|
|
|
count += count_gplayer_frames(ale->data, t->frame_side, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* stop if trying to build list if nothing selected */
|
|
|
|
if (count == 0) {
|
|
|
|
/* cleanup temp list */
|
2008-12-29 06:06:59 +00:00
|
|
|
BLI_freelistN(&anim_data);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* allocate memory for data */
|
|
|
|
t->total= count;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(Action Editor)");
|
2010-05-06 19:54:43 +00:00
|
|
|
t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "transdata2d");
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td= t->data;
|
2010-05-06 19:54:43 +00:00
|
|
|
td2d = t->data2d;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
if (ac.datatype == ANIMCONT_GPENCIL) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->mode == TFM_TIME_SLIDE) {
|
|
|
|
t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata");
|
|
|
|
tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->customData= MEM_callocN(sizeof(tGPFtransdata)*count, "tGPFtransdata");
|
|
|
|
tfd= (tGPFtransdata *)(t->customData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t->mode == TFM_TIME_SLIDE)
|
|
|
|
t->customData= MEM_callocN(sizeof(float)*2, "TimeSlide Min/Max");
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* loop 2: build transdata array */
|
2008-12-29 06:06:59 +00:00
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2011-01-10 22:10:28 +00:00
|
|
|
if (ale->type == ANIMTYPE_GPLAYER) {
|
|
|
|
bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = GPLayerToTransData(td, tfd, gpl, t->frame_side, cfra);
|
|
|
|
td += i;
|
|
|
|
tfd += i;
|
|
|
|
}
|
|
|
|
else {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
/* convert current-frame to action-time (slightly less accurate, espcially under
|
2009-07-12 02:01:13 +00:00
|
|
|
* higher scaling ratios, but is faster than converting all points)
|
2008-12-29 06:06:59 +00:00
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
|
2008-12-29 06:06:59 +00:00
|
|
|
else
|
|
|
|
cfra = (float)CFRA;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
td= ActionFCurveToTransData(td, &td2d, fcu, adt, t->frame_side, cfra);
|
2011-01-10 22:10:28 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* check if we're supposed to be setting minx/maxx for TimeSlide */
|
|
|
|
if (t->mode == TFM_TIME_SLIDE) {
|
|
|
|
float min=999999999.0f, max=-999999999.0f;
|
2011-06-02 11:58:13 +00:00
|
|
|
int i;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-06-02 11:58:13 +00:00
|
|
|
td= t->data;
|
|
|
|
for (i=0; i < count; i++, td++) {
|
|
|
|
if (min > *(td->val)) min= *(td->val);
|
|
|
|
if (max < *(td->val)) max= *(td->val);
|
2011-06-02 11:51:38 +00:00
|
|
|
}
|
2011-06-02 11:58:13 +00:00
|
|
|
|
|
|
|
if (min == max) {
|
2011-06-02 11:51:38 +00:00
|
|
|
/* just use the current frame ranges */
|
|
|
|
min = (float)PSFRA;
|
|
|
|
max = (float)PEFRA;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* minx/maxx values used by TimeSlide are stored as a
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* calloced 2-float array in t->customData. This gets freed
|
2009-07-12 02:01:13 +00:00
|
|
|
* in postTrans (T_FREE_CUSTOMDATA).
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
|
|
|
*((float *)(t->customData)) = min;
|
|
|
|
*((float *)(t->customData) + 1) = max;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* cleanup temp list */
|
2008-12-29 06:06:59 +00:00
|
|
|
BLI_freelistN(&anim_data);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* ********************* GRAPH EDITOR ************************* */
|
|
|
|
|
2009-01-28 09:55:36 +00:00
|
|
|
/* Helper function for createTransGraphEditData, which is reponsible for associating
|
2009-01-27 11:09:30 +00:00
|
|
|
* source data with transform data
|
|
|
|
*/
|
2010-05-15 02:40:44 +00:00
|
|
|
static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt, BezTriple *bezt,
|
|
|
|
int bi, short selected, short ishandle, short intvals,
|
|
|
|
float mtx[3][3], float smtx[3][3])
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
2010-05-06 19:54:43 +00:00
|
|
|
float *loc = bezt->vec[bi];
|
|
|
|
float *cent = bezt->vec[1];
|
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* New location from td gets dumped onto the old-location of td2d, which then
|
|
|
|
* gets copied to the actual data at td2d->loc2d (bezt->vec[n])
|
|
|
|
*
|
2009-06-23 13:25:31 +00:00
|
|
|
* Due to NLA mapping, we apply NLA mapping to some of the verts here,
|
|
|
|
* and then that mapping will be undone after transform is done.
|
2009-01-27 11:09:30 +00:00
|
|
|
*/
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt) {
|
2009-12-27 01:28:13 +00:00
|
|
|
td2d->loc[0] = BKE_nla_tweakedit_remap(adt, loc[0], NLATIME_CONVERT_MAP);
|
2010-02-18 09:32:24 +00:00
|
|
|
td2d->loc[1] = loc[1];
|
2009-01-27 11:09:30 +00:00
|
|
|
td2d->loc[2] = 0.0f;
|
|
|
|
td2d->loc2d = loc;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
td->loc = td2d->loc;
|
2009-12-27 01:28:13 +00:00
|
|
|
td->center[0] = BKE_nla_tweakedit_remap(adt, cent[0], NLATIME_CONVERT_MAP);
|
2010-02-18 09:32:24 +00:00
|
|
|
td->center[1] = cent[1];
|
2009-01-27 11:09:30 +00:00
|
|
|
td->center[2] = 0.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
td2d->loc[0] = loc[0];
|
2010-02-18 09:32:24 +00:00
|
|
|
td2d->loc[1] = loc[1];
|
2009-01-27 11:09:30 +00:00
|
|
|
td2d->loc[2] = 0.0f;
|
|
|
|
td2d->loc2d = loc;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
td->loc = td2d->loc;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, cent);
|
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2010-05-06 19:54:43 +00:00
|
|
|
|
|
|
|
if (td->flag & TD_MOVEHANDLE1) {
|
|
|
|
td2d->h1 = bezt->vec[0];
|
|
|
|
VECCOPY2D(td2d->ih1, td2d->h1);
|
2010-05-07 10:59:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
td2d->h1 = NULL;
|
2010-05-06 19:54:43 +00:00
|
|
|
|
|
|
|
if (td->flag & TD_MOVEHANDLE2) {
|
|
|
|
td2d->h2 = bezt->vec[2];
|
|
|
|
VECCOPY2D(td2d->ih2, td2d->h2);
|
2010-05-07 10:59:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
td2d->h2 = NULL;
|
2010-05-06 19:54:43 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
memset(td->axismtx, 0, sizeof(td->axismtx));
|
|
|
|
td->axismtx[2][2] = 1.0f;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
td->ext= NULL; td->val= NULL;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* store AnimData info in td->extra, for applying mapping when flushing */
|
|
|
|
td->extra= adt;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
if (selected) {
|
|
|
|
td->flag |= TD_SELECTED;
|
2009-01-28 09:55:36 +00:00
|
|
|
td->dist= 0.0f;
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
td->dist= MAXFLOAT;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if (ishandle)
|
2009-01-27 11:09:30 +00:00
|
|
|
td->flag |= TD_NOTIMESNAP;
|
2009-03-18 10:58:18 +00:00
|
|
|
if (intvals)
|
|
|
|
td->flag |= TD_INTVALUES;
|
2010-05-06 19:54:43 +00:00
|
|
|
|
2010-05-15 02:40:44 +00:00
|
|
|
/* copy space-conversion matrices for dealing with non-uniform scales */
|
|
|
|
copy_m3_m3(td->mtx, mtx);
|
|
|
|
copy_m3_m3(td->smtx, smtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2009-01-28 02:56:58 +00:00
|
|
|
|
|
|
|
static void createTransGraphEditData(bContext *C, TransInfo *t)
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
2010-12-15 16:07:49 +00:00
|
|
|
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene= t->scene;
|
|
|
|
ARegion *ar= t->ar;
|
2009-01-28 02:56:58 +00:00
|
|
|
View2D *v2d= &ar->v2d;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
TransData *td = NULL;
|
|
|
|
TransData2D *td2d = NULL;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
bAnimContext ac;
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int filter;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-10-16 06:24:39 +00:00
|
|
|
BezTriple *bezt;
|
2009-01-28 02:56:58 +00:00
|
|
|
int count=0, i;
|
|
|
|
float cfra;
|
2010-05-15 02:40:44 +00:00
|
|
|
float mtx[3][3], smtx[3][3];
|
2010-12-15 16:07:49 +00:00
|
|
|
const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* determine what type of data we are operating on */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
|
|
|
return;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* filter data */
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
|
2009-01-28 02:56:58 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* which side of the current frame should be allowed */
|
|
|
|
// XXX we still want this mode, but how to get this using standard transform too?
|
|
|
|
if (t->mode == TFM_TIME_EXTEND) {
|
|
|
|
/* only side on which mouse is gets transformed */
|
|
|
|
float xmouse, ymouse;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-10-21 10:36:46 +00:00
|
|
|
UI_view2d_region_to_view(v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
|
2010-03-08 09:06:58 +00:00
|
|
|
t->frame_side = (xmouse > CFRA) ? 'R' : 'L'; // XXX use t->frame_side
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* normal transform - both sides of current frame are considered */
|
2010-03-08 09:06:58 +00:00
|
|
|
t->frame_side = 'B';
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* loop 1: count how many BezTriples (specifically their verts) are selected (or should be edited) */
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
|
2009-01-28 02:56:58 +00:00
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* convert current-frame to action-time (slightly less accurate, espcially under
|
2009-07-12 02:01:13 +00:00
|
|
|
* higher scaling ratios, but is faster than converting all points)
|
2009-01-28 02:56:58 +00:00
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
|
2009-01-28 02:56:58 +00:00
|
|
|
else
|
|
|
|
cfra = (float)CFRA;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-10-16 06:24:39 +00:00
|
|
|
/* F-Curve may not have any keyframes */
|
|
|
|
if (fcu->bezt == NULL)
|
|
|
|
continue;
|
2010-05-15 02:40:44 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse */
|
2009-10-16 06:24:39 +00:00
|
|
|
for (i=0, bezt=fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
2010-03-08 09:06:58 +00:00
|
|
|
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
|
2010-12-15 16:07:49 +00:00
|
|
|
const char sel2= bezt->f2 & SELECT;
|
2011-09-29 05:03:21 +00:00
|
|
|
const char sel1= use_handle ? bezt->f1 & SELECT : sel2;
|
|
|
|
const char sel3= use_handle ? bezt->f3 & SELECT : sel2;
|
2010-12-15 16:07:49 +00:00
|
|
|
|
2010-09-24 09:18:28 +00:00
|
|
|
if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
|
2010-05-06 19:54:43 +00:00
|
|
|
/* for 'normal' pivots - just include anything that is selected.
|
|
|
|
this works a bit differently in translation modes */
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel2) count++;
|
2010-05-06 19:54:43 +00:00
|
|
|
else {
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel1) count++;
|
|
|
|
if (sel3) count++;
|
2010-05-06 19:54:43 +00:00
|
|
|
}
|
2010-05-15 02:40:44 +00:00
|
|
|
}
|
2010-09-24 09:18:28 +00:00
|
|
|
else if (sipo->around == V3D_LOCAL) {
|
|
|
|
/* for local-pivot we only need to count the number of selected handles only, so that centerpoints don't
|
|
|
|
* don't get moved wrong
|
|
|
|
*/
|
|
|
|
if (bezt->ipo == BEZT_IPO_BEZ) {
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel1) count++;
|
|
|
|
if (sel3) count++;
|
2010-09-24 09:18:28 +00:00
|
|
|
}
|
2010-12-15 16:07:49 +00:00
|
|
|
/* else if (sel2) count++; // TODO: could this cause problems? */
|
2010-09-24 09:18:28 +00:00
|
|
|
/* - yes this causes problems, because no td is created for the center point */
|
|
|
|
}
|
2010-05-15 02:40:44 +00:00
|
|
|
else {
|
2009-10-16 06:24:39 +00:00
|
|
|
/* for 'normal' pivots - just include anything that is selected */
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel1) count++;
|
|
|
|
if (sel2) count++;
|
|
|
|
if (sel3) count++;
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* stop if trying to build list if nothing selected */
|
|
|
|
if (count == 0) {
|
|
|
|
/* cleanup temp list */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
return;
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* allocate memory for data */
|
|
|
|
t->total= count;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransData (Graph Editor)");
|
|
|
|
/* for each 2d vert a 3d vector is allocated, so that they can be treated just as if they were 3d verts */
|
|
|
|
t->data2d= MEM_callocN(t->total*sizeof(TransData2D), "TransData2D (Graph Editor)");
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
td= t->data;
|
|
|
|
td2d= t->data2d;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-05-15 02:40:44 +00:00
|
|
|
/* precompute space-conversion matrices for dealing with non-uniform scaling of Graph Editor */
|
|
|
|
unit_m3(mtx);
|
|
|
|
unit_m3(smtx);
|
|
|
|
|
2010-05-15 03:55:34 +00:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
|
2010-05-15 02:40:44 +00:00
|
|
|
float xscale, yscale;
|
|
|
|
|
|
|
|
/* apply scale factors to x and y axes of space-conversion matrices */
|
|
|
|
UI_view2d_getscale(v2d, &xscale, &yscale);
|
|
|
|
|
|
|
|
/* mtx is data to global (i.e. view) conversion */
|
|
|
|
mul_v3_fl(mtx[0], xscale);
|
|
|
|
mul_v3_fl(mtx[1], yscale);
|
|
|
|
|
|
|
|
/* smtx is global (i.e. view) to data conversion */
|
2011-03-28 17:06:15 +00:00
|
|
|
if (IS_EQF(xscale, 0.0f) == 0) mul_v3_fl(smtx[0], 1.0f/xscale);
|
|
|
|
if (IS_EQF(yscale, 0.0f) == 0) mul_v3_fl(smtx[1], 1.0f/yscale);
|
2010-05-15 02:40:44 +00:00
|
|
|
}
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* loop 2: build transdata arrays */
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
|
2009-01-28 02:56:58 +00:00
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2009-03-18 10:58:18 +00:00
|
|
|
short intvals= (fcu->flag & FCURVE_INT_VALUES);
|
2010-05-15 02:40:44 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* convert current-frame to action-time (slightly less accurate, espcially under
|
2009-07-12 02:01:13 +00:00
|
|
|
* higher scaling ratios, but is faster than converting all points)
|
2009-06-23 13:25:31 +00:00
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
|
2009-06-23 13:25:31 +00:00
|
|
|
else
|
|
|
|
cfra = (float)CFRA;
|
2009-10-16 06:24:39 +00:00
|
|
|
|
|
|
|
/* F-Curve may not have any keyframes */
|
|
|
|
if (fcu->bezt == NULL)
|
|
|
|
continue;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-01-26 09:25:32 +00:00
|
|
|
ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL|ANIM_UNITCONV_SELVERTS);
|
2010-01-26 05:58:03 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* only include BezTriples whose 'keyframe' occurs on the same side of the current frame as mouse (if applicable) */
|
2009-10-16 06:24:39 +00:00
|
|
|
for (i=0, bezt= fcu->bezt; i < fcu->totvert; i++, bezt++) {
|
2010-03-08 09:06:58 +00:00
|
|
|
if (FrameOnMouseSide(t->frame_side, bezt->vec[1][0], cfra)) {
|
2010-12-15 16:07:49 +00:00
|
|
|
const char sel2= bezt->f2 & SELECT;
|
2011-09-29 05:03:21 +00:00
|
|
|
const char sel1= use_handle ? bezt->f1 & SELECT : sel2;
|
|
|
|
const char sel3= use_handle ? bezt->f3 & SELECT : sel2;
|
2010-12-15 16:07:49 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
TransDataCurveHandleFlags *hdata = NULL;
|
2011-09-20 08:48:48 +00:00
|
|
|
/* short h1=1, h2=1; */ /* UNUSED */
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
/* only include handles if selected, irrespective of the interpolation modes.
|
2010-05-15 02:40:44 +00:00
|
|
|
* also, only treat handles specially if the center point isn't selected.
|
|
|
|
*/
|
2010-12-15 16:07:49 +00:00
|
|
|
if (!ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE) || !(sel2)) {
|
|
|
|
if (sel1) {
|
2009-10-16 10:01:15 +00:00
|
|
|
hdata = initTransDataCurveHandles(td, bezt);
|
2010-05-15 02:40:44 +00:00
|
|
|
bezt_to_transdata(td++, td2d++, adt, bezt, 0, 1, 1, intvals, mtx, smtx);
|
|
|
|
}
|
2011-09-20 08:48:48 +00:00
|
|
|
else {
|
|
|
|
/* h1= 0; */ /* UNUSED */
|
|
|
|
}
|
2010-05-15 02:40:44 +00:00
|
|
|
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel3) {
|
2010-05-06 19:54:43 +00:00
|
|
|
if (hdata==NULL)
|
|
|
|
hdata = initTransDataCurveHandles(td, bezt);
|
2010-05-15 02:40:44 +00:00
|
|
|
bezt_to_transdata(td++, td2d++, adt, bezt, 2, 1, 1, intvals, mtx, smtx);
|
|
|
|
}
|
2011-09-20 08:48:48 +00:00
|
|
|
else {
|
|
|
|
/* h2= 0; */ /* UNUSED */
|
|
|
|
}
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2010-05-15 02:40:44 +00:00
|
|
|
|
|
|
|
/* only include main vert if selected */
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel2 && (sipo->around != V3D_LOCAL || ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE))) {
|
2010-09-24 09:18:28 +00:00
|
|
|
|
2010-05-15 02:40:44 +00:00
|
|
|
/* move handles relative to center */
|
2010-05-06 19:54:43 +00:00
|
|
|
if (ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE)) {
|
2010-12-15 16:07:49 +00:00
|
|
|
if (sel1) td->flag |= TD_MOVEHANDLE1;
|
|
|
|
if (sel3) td->flag |= TD_MOVEHANDLE2;
|
2010-05-06 19:54:43 +00:00
|
|
|
}
|
2010-05-15 02:40:44 +00:00
|
|
|
|
2010-09-24 09:18:28 +00:00
|
|
|
/* if handles were not selected, store their selection status */
|
2010-12-15 16:07:49 +00:00
|
|
|
if (!(sel1) && !(sel3)) {
|
2010-09-24 09:18:28 +00:00
|
|
|
if (hdata == NULL)
|
|
|
|
hdata = initTransDataCurveHandles(td, bezt);
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
2010-09-24 09:18:28 +00:00
|
|
|
|
|
|
|
bezt_to_transdata(td++, td2d++, adt, bezt, 1, 1, 0, intvals, mtx, smtx);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-09-24 09:18:28 +00:00
|
|
|
}
|
|
|
|
/* special hack (must be done after initTransDataCurveHandles(), as that stores handle settings to restore...):
|
|
|
|
* - Check if we've got entire BezTriple selected and we're scaling/rotating that point,
|
|
|
|
* then check if we're using auto-handles.
|
|
|
|
* - If so, change them auto-handles to aligned handles so that handles get affected too
|
|
|
|
*/
|
2011-08-05 11:23:28 +00:00
|
|
|
if (ELEM(bezt->h1, HD_AUTO, HD_AUTO_ANIM) && ELEM(bezt->h2, HD_AUTO, HD_AUTO_ANIM) && ELEM(t->mode, TFM_ROTATION, TFM_RESIZE)) {
|
2010-12-15 16:07:49 +00:00
|
|
|
if (hdata && (sel1) && (sel3)) {
|
2010-09-24 09:18:28 +00:00
|
|
|
bezt->h1= HD_ALIGN;
|
|
|
|
bezt->h2= HD_ALIGN;
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* Sets handles based on the selection */
|
2011-09-29 05:03:21 +00:00
|
|
|
testhandles_fcurve(fcu, use_handle);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* cleanup temp list */
|
|
|
|
BLI_freelistN(&anim_data);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* ------------------------ */
|
|
|
|
|
2011-01-13 23:53:14 +00:00
|
|
|
/* struct for use in re-sorting BezTriples during Graph Editor transform */
|
2009-01-27 11:09:30 +00:00
|
|
|
typedef struct BeztMap {
|
|
|
|
BezTriple *bezt;
|
2011-01-13 23:53:14 +00:00
|
|
|
unsigned int oldIndex; /* index of bezt in fcu->bezt array before sorting */
|
|
|
|
unsigned int newIndex; /* index of bezt in fcu->bezt array after sorting */
|
|
|
|
short swapHs; /* swap order of handles (-1=clear; 0=not checked, 1=swap) */
|
|
|
|
char pipo, cipo; /* interpolation of current and next segments */
|
2009-01-27 11:09:30 +00:00
|
|
|
} BeztMap;
|
|
|
|
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* This function converts an FCurve's BezTriple array to a BeztMap array
|
2009-01-27 11:09:30 +00:00
|
|
|
* NOTE: this allocates memory that will need to get freed later
|
|
|
|
*/
|
2010-12-15 16:07:49 +00:00
|
|
|
static BeztMap *bezt_to_beztmaps (BezTriple *bezts, int totvert, const short UNUSED(use_handle))
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
|
|
|
BezTriple *bezt= bezts;
|
|
|
|
BezTriple *prevbezt= NULL;
|
|
|
|
BeztMap *bezm, *bezms;
|
|
|
|
int i;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* allocate memory for this array */
|
|
|
|
if (totvert==0 || bezts==NULL)
|
|
|
|
return NULL;
|
|
|
|
bezm= bezms= MEM_callocN(sizeof(BeztMap)*totvert, "BeztMaps");
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* assign beztriples to beztmaps */
|
|
|
|
for (i=0; i < totvert; i++, bezm++, prevbezt=bezt, bezt++) {
|
|
|
|
bezm->bezt= bezt;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
bezm->oldIndex= i;
|
|
|
|
bezm->newIndex= i;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
bezm->pipo= (prevbezt) ? prevbezt->ipo : bezt->ipo;
|
|
|
|
bezm->cipo= bezt->ipo;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
return bezms;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function copies the code of sort_time_ipocurve, but acts on BeztMap structs instead */
|
2010-12-15 16:07:49 +00:00
|
|
|
static void sort_time_beztmaps (BeztMap *bezms, int totvert, const short UNUSED(use_handle))
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
|
|
|
BeztMap *bezm;
|
|
|
|
int i, ok= 1;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* keep repeating the process until nothing is out of place anymore */
|
|
|
|
while (ok) {
|
|
|
|
ok= 0;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
bezm= bezms;
|
|
|
|
i= totvert;
|
|
|
|
while (i--) {
|
|
|
|
/* is current bezm out of order (i.e. occurs later than next)? */
|
|
|
|
if (i > 0) {
|
|
|
|
if (bezm->bezt->vec[1][0] > (bezm+1)->bezt->vec[1][0]) {
|
|
|
|
bezm->newIndex++;
|
|
|
|
(bezm+1)->newIndex--;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
SWAP(BeztMap, *bezm, *(bezm+1));
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
ok= 1;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* do we need to check if the handles need to be swapped?
|
|
|
|
* optimisation: this only needs to be performed in the first loop
|
|
|
|
*/
|
|
|
|
if (bezm->swapHs == 0) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if ( (bezm->bezt->vec[0][0] > bezm->bezt->vec[1][0]) &&
|
2009-01-27 11:09:30 +00:00
|
|
|
(bezm->bezt->vec[2][0] < bezm->bezt->vec[1][0]) )
|
|
|
|
{
|
|
|
|
/* handles need to be swapped */
|
|
|
|
bezm->swapHs = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* handles need to be cleared */
|
|
|
|
bezm->swapHs = -1;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
bezm++;
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* This function firstly adjusts the pointers that the transdata has to each BezTriple */
|
2011-03-02 19:06:09 +00:00
|
|
|
static void beztmap_to_data (TransInfo *t, FCurve *fcu, BeztMap *bezms, int totvert, const short UNUSED(use_handle))
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
2009-01-28 02:56:58 +00:00
|
|
|
BezTriple *bezts = fcu->bezt;
|
2009-01-27 11:09:30 +00:00
|
|
|
BeztMap *bezm;
|
2011-03-02 17:32:01 +00:00
|
|
|
TransData2D *td2d;
|
|
|
|
TransData *td;
|
2009-01-27 11:09:30 +00:00
|
|
|
int i, j;
|
|
|
|
char *adjusted;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* dynamically allocate an array of chars to mark whether an TransData's
|
2009-01-27 11:09:30 +00:00
|
|
|
* pointers have been fixed already, so that we don't override ones that are
|
|
|
|
* already done
|
2010-03-22 09:30:00 +00:00
|
|
|
*/
|
2009-01-27 11:09:30 +00:00
|
|
|
adjusted= MEM_callocN(t->total, "beztmap_adjusted_map");
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* for each beztmap item, find if it is used anywhere */
|
|
|
|
bezm= bezms;
|
|
|
|
for (i= 0; i < totvert; i++, bezm++) {
|
2009-07-12 02:01:13 +00:00
|
|
|
/* loop through transdata, testing if we have a hit
|
2009-01-27 11:09:30 +00:00
|
|
|
* for the handles (vec[0]/vec[2]), we must also check if they need to be swapped...
|
|
|
|
*/
|
2011-03-02 17:32:01 +00:00
|
|
|
td2d= t->data2d;
|
|
|
|
td= t->data;
|
|
|
|
for (j= 0; j < t->total; j++, td2d++, td++) {
|
2009-01-27 11:09:30 +00:00
|
|
|
/* skip item if already marked */
|
|
|
|
if (adjusted[j] != 0) continue;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-03-02 17:32:01 +00:00
|
|
|
/* update all transdata pointers, no need to check for selections etc,
|
|
|
|
* since only points that are really needed were created as transdata
|
|
|
|
*/
|
|
|
|
if (td2d->loc2d == bezm->bezt->vec[0]) {
|
|
|
|
if (bezm->swapHs == 1)
|
|
|
|
td2d->loc2d= (bezts + bezm->newIndex)->vec[2];
|
|
|
|
else
|
|
|
|
td2d->loc2d= (bezts + bezm->newIndex)->vec[0];
|
|
|
|
adjusted[j] = 1;
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
2011-03-02 17:32:01 +00:00
|
|
|
else if (td2d->loc2d == bezm->bezt->vec[2]) {
|
|
|
|
if (bezm->swapHs == 1)
|
|
|
|
td2d->loc2d= (bezts + bezm->newIndex)->vec[0];
|
|
|
|
else
|
|
|
|
td2d->loc2d= (bezts + bezm->newIndex)->vec[2];
|
|
|
|
adjusted[j] = 1;
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
2011-03-02 17:32:01 +00:00
|
|
|
else if (td2d->loc2d == bezm->bezt->vec[1]) {
|
|
|
|
td2d->loc2d= (bezts + bezm->newIndex)->vec[1];
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2011-03-02 17:32:01 +00:00
|
|
|
/* if only control point is selected, the handle pointers need to be updated as well */
|
|
|
|
if(td2d->h1)
|
|
|
|
td2d->h1= (bezts + bezm->newIndex)->vec[0];
|
|
|
|
if(td2d->h2)
|
|
|
|
td2d->h2= (bezts + bezm->newIndex)->vec[2];
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2011-03-02 17:32:01 +00:00
|
|
|
adjusted[j] = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the handle type pointer has to be updated too */
|
|
|
|
if (adjusted[j] && td->flag & TD_BEZTRIPLE && td->hdata) {
|
|
|
|
if(bezm->swapHs == 1) {
|
|
|
|
td->hdata->h1 = &(bezts + bezm->newIndex)->h2;
|
|
|
|
td->hdata->h2 = &(bezts + bezm->newIndex)->h1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->hdata->h1 = &(bezts + bezm->newIndex)->h1;
|
|
|
|
td->hdata->h2 = &(bezts + bezm->newIndex)->h2;
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* free temp memory used for 'adjusted' array */
|
|
|
|
MEM_freeN(adjusted);
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* This function is called by recalcData during the Transform loop to recalculate
|
2009-01-27 11:09:30 +00:00
|
|
|
* the handles of curves and sort the keyframes so that the curves draw correctly.
|
|
|
|
* It is only called if some keyframes have moved out of order.
|
2009-01-28 02:56:58 +00:00
|
|
|
*
|
2009-07-12 02:01:13 +00:00
|
|
|
* anim_data is the list of channels (F-Curves) retrieved already containing the
|
2009-01-28 02:56:58 +00:00
|
|
|
* channels to work on. It should not be freed here as it may still need to be used.
|
2009-01-27 11:09:30 +00:00
|
|
|
*/
|
2009-01-28 02:56:58 +00:00
|
|
|
void remake_graph_transdata (TransInfo *t, ListBase *anim_data)
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
2010-12-15 16:07:49 +00:00
|
|
|
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
|
2009-01-27 11:09:30 +00:00
|
|
|
bAnimListElem *ale;
|
2010-12-15 16:07:49 +00:00
|
|
|
const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* sort and reassign verts */
|
|
|
|
for (ale= anim_data->first; ale; ale= ale->next) {
|
2009-01-27 11:09:30 +00:00
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
if (fcu->bezt) {
|
|
|
|
BeztMap *bezm;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* adjust transform-data pointers */
|
2011-03-02 19:06:09 +00:00
|
|
|
/* note, none of these functions use 'use_handle', it could be removed */
|
2010-12-15 16:07:49 +00:00
|
|
|
bezm= bezt_to_beztmaps(fcu->bezt, fcu->totvert, use_handle);
|
|
|
|
sort_time_beztmaps(bezm, fcu->totvert, use_handle);
|
|
|
|
beztmap_to_data(t, fcu, bezm, fcu->totvert, use_handle);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* free mapping stuff */
|
|
|
|
MEM_freeN(bezm);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-02-05 03:28:07 +00:00
|
|
|
/* re-sort actual beztriples (perhaps this could be done using the beztmaps to save time?) */
|
|
|
|
sort_time_fcurve(fcu);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* make sure handles are all set correctly */
|
2011-09-29 05:03:21 +00:00
|
|
|
testhandles_fcurve(fcu, use_handle);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* this function is called on recalcData to apply the transforms applied
|
2009-07-12 02:01:13 +00:00
|
|
|
* to the transdata on to the actual keyframe data
|
2009-01-27 11:09:30 +00:00
|
|
|
*/
|
2009-01-28 02:56:58 +00:00
|
|
|
void flushTransGraphData(TransInfo *t)
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
2009-01-28 02:56:58 +00:00
|
|
|
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
|
|
|
|
TransData *td;
|
|
|
|
TransData2D *td2d;
|
2009-07-07 06:21:38 +00:00
|
|
|
Scene *scene= t->scene;
|
|
|
|
double secf= FPS;
|
2009-01-27 11:09:30 +00:00
|
|
|
int a;
|
2010-02-17 19:50:42 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* flush to 2d vector from internally used 3d vector */
|
2009-01-28 02:56:58 +00:00
|
|
|
for (a=0, td= t->data, td2d=t->data2d; a<t->total; a++, td++, td2d++) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= (AnimData *)td->extra; /* pointers to relevant AnimData blocks are stored in the td->extra pointers */
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* handle snapping for time values
|
|
|
|
* - we should still be in NLA-mapping timespace
|
2009-01-28 02:56:58 +00:00
|
|
|
* - only apply to keyframes (but never to handles)
|
|
|
|
*/
|
|
|
|
if ((td->flag & TD_NOTIMESNAP)==0) {
|
|
|
|
switch (sipo->autosnap) {
|
2009-07-07 06:21:38 +00:00
|
|
|
case SACTSNAP_FRAME: /* snap to nearest frame (or second if drawing seconds) */
|
|
|
|
if (sipo->flag & SIPO_DRAWTIME)
|
|
|
|
td2d->loc[0]= (float)( floor((td2d->loc[0]/secf) + 0.5f) * secf );
|
|
|
|
else
|
|
|
|
td2d->loc[0]= (float)( floor(td2d->loc[0]+0.5f) );
|
2009-01-28 02:56:58 +00:00
|
|
|
break;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
case SACTSNAP_MARKER: /* snap to nearest marker */
|
2009-07-07 06:16:06 +00:00
|
|
|
td2d->loc[0]= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, td2d->loc[0]);
|
2009-01-28 02:56:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2009-07-12 03:42:39 +00:00
|
|
|
/* we need to unapply the nla-mapping from the time in some situations */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
td2d->loc2d[0]= BKE_nla_tweakedit_remap(adt, td2d->loc[0], NLATIME_CONVERT_UNMAP);
|
2009-06-23 13:25:31 +00:00
|
|
|
else
|
2009-01-28 02:56:58 +00:00
|
|
|
td2d->loc2d[0]= td2d->loc[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-03-18 10:58:18 +00:00
|
|
|
/* if int-values only, truncate to integers */
|
|
|
|
if (td->flag & TD_INTVALUES)
|
2011-05-20 18:19:29 +00:00
|
|
|
td2d->loc2d[1]= floorf(td2d->loc[1] + 0.5f);
|
2009-03-18 10:58:18 +00:00
|
|
|
else
|
2010-02-18 09:32:24 +00:00
|
|
|
td2d->loc2d[1]= td2d->loc[1];
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) {
|
|
|
|
td2d->h1[0] = td2d->ih1[0] + td->loc[0] - td->iloc[0];
|
|
|
|
td2d->h1[1] = td2d->ih1[1] + td->loc[1] - td->iloc[1];
|
|
|
|
}
|
2011-01-13 23:53:14 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
if ((td->flag & TD_MOVEHANDLE2) && td2d->h2) {
|
|
|
|
td2d->h2[0] = td2d->ih2[0] + td->loc[0] - td->iloc[0];
|
|
|
|
td2d->h2[1] = td2d->ih2[1] + td->loc[1] - td->iloc[1];
|
|
|
|
}
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-20 20:51:38 +00:00
|
|
|
/* ******************* Sequencer Transform data ******************* */
|
2009-01-21 07:01:20 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
/* This function applies the rules for transforming a strip so duplicate
|
|
|
|
* checks dont need to be added in multiple places.
|
|
|
|
*
|
2009-01-24 09:55:31 +00:00
|
|
|
* recursive, count and flag MUST be set.
|
2009-01-23 23:14:02 +00:00
|
|
|
*
|
2009-01-24 09:55:31 +00:00
|
|
|
* seq->depth must be set before running this function so we know if the strips
|
|
|
|
* are root level or not
|
2009-01-23 23:14:02 +00:00
|
|
|
*/
|
2009-01-24 05:38:25 +00:00
|
|
|
static void SeqTransInfo(TransInfo *t, Sequence *seq, int *recursive, int *count, int *flag)
|
2009-01-23 23:14:02 +00:00
|
|
|
{
|
2009-01-24 05:38:25 +00:00
|
|
|
/* for extend we need to do some tricks */
|
|
|
|
if (t->mode == TFM_TIME_EXTEND) {
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
/* *** Extend Transform *** */
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
Scene * scene= t->scene;
|
|
|
|
int cfra= CFRA;
|
|
|
|
int left= seq_tx_get_final_left(seq, 0);
|
|
|
|
int right= seq_tx_get_final_right(seq, 0);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2009-01-26 09:13:15 +00:00
|
|
|
if (seq->depth == 0 && ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK))) {
|
2009-01-24 05:38:25 +00:00
|
|
|
*recursive= 0;
|
|
|
|
*count= 0;
|
|
|
|
*flag= 0;
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
else if (seq->type ==SEQ_META) {
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
/* for meta's we only ever need to extend their children, no matter what depth
|
|
|
|
* just check the meta's are in the bounds */
|
|
|
|
if (t->frame_side=='R' && right <= cfra) *recursive= 0;
|
|
|
|
else if (t->frame_side=='L' && left >= cfra) *recursive= 0;
|
|
|
|
else *recursive= 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
*count= 0;
|
|
|
|
*flag= 0;
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
else {
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
*recursive= 0; /* not a meta, so no thinking here */
|
|
|
|
*count= 1; /* unless its set to 0, extend will never set 2 handles at once */
|
|
|
|
*flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
if (t->frame_side=='R') {
|
|
|
|
if (right <= cfra) *count= *flag= 0; /* ignore */
|
|
|
|
else if (left > cfra) ; /* keep the selection */
|
|
|
|
else *flag |= SEQ_RIGHTSEL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (left >= cfra) *count= *flag= 0; /* ignore */
|
|
|
|
else if (right < cfra) ; /* keep the selection */
|
|
|
|
else *flag |= SEQ_LEFTSEL;
|
|
|
|
}
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
} else {
|
|
|
|
|
2010-03-16 18:01:22 +00:00
|
|
|
t->frame_side= 'B';
|
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
/* *** Normal Transform *** */
|
|
|
|
|
|
|
|
if (seq->depth == 0) {
|
|
|
|
|
|
|
|
/* Count */
|
|
|
|
|
|
|
|
/* Non nested strips (resect selection and handles) */
|
2009-01-26 09:13:15 +00:00
|
|
|
if ((seq->flag & SELECT) == 0 || (seq->flag & SEQ_LOCK)) {
|
2009-01-24 05:38:25 +00:00
|
|
|
*recursive= 0;
|
|
|
|
*count= 0;
|
|
|
|
*flag= 0;
|
|
|
|
}
|
2009-01-24 09:55:31 +00:00
|
|
|
else {
|
|
|
|
if ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == (SEQ_LEFTSEL|SEQ_RIGHTSEL)) {
|
|
|
|
*flag= seq->flag;
|
|
|
|
*count= 2; /* we need 2 transdata's */
|
|
|
|
} else {
|
|
|
|
*flag= seq->flag;
|
|
|
|
*count= 1; /* selected or with a handle selected */
|
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
|
2009-01-24 09:55:31 +00:00
|
|
|
/* Recursive */
|
2009-01-24 05:38:25 +00:00
|
|
|
|
2009-01-24 09:55:31 +00:00
|
|
|
if ((seq->type == SEQ_META) && ((seq->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) == 0)) {
|
|
|
|
/* if any handles are selected, dont recurse */
|
|
|
|
*recursive = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*recursive = 0;
|
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
}
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-01-24 05:38:25 +00:00
|
|
|
/* Nested, different rules apply */
|
|
|
|
|
2011-09-28 10:05:56 +00:00
|
|
|
#ifdef SEQ_TX_NESTED_METAS
|
|
|
|
*flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
|
|
|
|
*count= 1; /* ignore the selection for nested */
|
|
|
|
*recursive = (seq->type == SEQ_META );
|
|
|
|
#else
|
2009-01-24 05:38:25 +00:00
|
|
|
if (seq->type == SEQ_META) {
|
|
|
|
/* Meta's can only directly be moved between channels since they
|
|
|
|
* dont have their start and length set directly (children affect that)
|
|
|
|
* since this Meta is nested we dont need any of its data infact.
|
|
|
|
* calc_sequence() will update its settings when run on the toplevel meta */
|
|
|
|
*flag= 0;
|
|
|
|
*count= 0;
|
|
|
|
*recursive = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*flag= (seq->flag | SELECT) & ~(SEQ_LEFTSEL|SEQ_RIGHTSEL);
|
|
|
|
*count= 1; /* ignore the selection for nested */
|
|
|
|
*recursive = 0;
|
|
|
|
}
|
2011-09-28 10:05:56 +00:00
|
|
|
#endif
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
static int SeqTransCount(TransInfo *t, ListBase *seqbase, int depth)
|
2009-01-23 23:14:02 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
|
|
|
int tot= 0, recursive, count, flag;
|
|
|
|
|
|
|
|
for (seq= seqbase->first; seq; seq= seq->next) {
|
|
|
|
seq->depth= depth;
|
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
SeqTransInfo(t, seq, &recursive, &count, &flag); /* ignore the flag */
|
2009-01-23 23:14:02 +00:00
|
|
|
tot += count;
|
|
|
|
|
|
|
|
if (recursive) {
|
2009-01-24 05:38:25 +00:00
|
|
|
tot += SeqTransCount(t, &seq->seqbase, depth+1);
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return tot;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static TransData *SeqToTransData(TransData *td, TransData2D *td2d, TransDataSeq *tdsq, Sequence *seq, int flag, int sel_flag)
|
2009-01-21 07:01:20 +00:00
|
|
|
{
|
2009-01-24 05:38:25 +00:00
|
|
|
int start_left;
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
switch(sel_flag) {
|
|
|
|
case SELECT:
|
2009-01-24 05:38:25 +00:00
|
|
|
/* Use seq_tx_get_final_left() and an offset here
|
|
|
|
* so transform has the left hand location of the strip.
|
|
|
|
* tdsq->start_offset is used when flushing the tx data back */
|
|
|
|
start_left= seq_tx_get_final_left(seq, 0);
|
|
|
|
td2d->loc[0]= start_left;
|
|
|
|
tdsq->start_offset= start_left - seq->start; /* use to apply the original location */
|
2009-01-21 07:01:20 +00:00
|
|
|
break;
|
|
|
|
case SEQ_LEFTSEL:
|
2009-01-24 05:38:25 +00:00
|
|
|
start_left= seq_tx_get_final_left(seq, 0);
|
|
|
|
td2d->loc[0] = start_left;
|
2009-01-21 07:01:20 +00:00
|
|
|
break;
|
|
|
|
case SEQ_RIGHTSEL:
|
|
|
|
td2d->loc[0] = seq_tx_get_final_right(seq, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
td2d->loc[1] = seq->machine; /* channel - Y location */
|
|
|
|
td2d->loc[2] = 0.0f;
|
|
|
|
td2d->loc2d = NULL;
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
tdsq->seq= seq;
|
2009-01-23 23:14:02 +00:00
|
|
|
|
|
|
|
/* Use instead of seq->flag for nested strips and other
|
|
|
|
* cases where the selection may need to be modified */
|
|
|
|
tdsq->flag= flag;
|
|
|
|
tdsq->sel_flag= sel_flag;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
td->extra= (void *)tdsq; /* allow us to update the strip from here */
|
|
|
|
|
|
|
|
td->flag = 0;
|
|
|
|
td->loc = td2d->loc;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2009-01-21 07:01:20 +00:00
|
|
|
|
|
|
|
memset(td->axismtx, 0, sizeof(td->axismtx));
|
|
|
|
td->axismtx[2][2] = 1.0f;
|
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
td->ext= NULL; td->val= NULL;
|
2009-01-21 07:01:20 +00:00
|
|
|
|
|
|
|
td->flag |= TD_SELECTED;
|
|
|
|
td->dist= 0.0;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->mtx);
|
|
|
|
unit_m3(td->smtx);
|
2009-01-21 07:01:20 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
/* Time Transform (extend) */
|
|
|
|
td->val= td2d->loc;
|
|
|
|
td->ival= td2d->loc[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
return td;
|
|
|
|
}
|
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
static int SeqToTransData_Recursive(TransInfo *t, ListBase *seqbase, TransData *td, TransData2D *td2d, TransDataSeq *tdsq)
|
2009-01-23 23:14:02 +00:00
|
|
|
{
|
|
|
|
Sequence *seq;
|
|
|
|
int recursive, count, flag;
|
|
|
|
int tot= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
for (seq= seqbase->first; seq; seq= seq->next) {
|
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
SeqTransInfo(t, seq, &recursive, &count, &flag);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
/* add children first so recalculating metastrips does nested strips first */
|
|
|
|
if (recursive) {
|
2009-01-24 05:38:25 +00:00
|
|
|
int tot_children= SeqToTransData_Recursive(t, &seq->seqbase, td, td2d, tdsq);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
td= td + tot_children;
|
|
|
|
td2d= td2d + tot_children;
|
|
|
|
tdsq= tdsq + tot_children;
|
|
|
|
|
|
|
|
tot += tot_children;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* use 'flag' which is derived from seq->flag but modified for special cases */
|
|
|
|
if (flag & SELECT) {
|
|
|
|
if (flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL)) {
|
|
|
|
if (flag & SEQ_LEFTSEL) {
|
2010-10-16 14:32:17 +00:00
|
|
|
SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_LEFTSEL);
|
2009-01-23 23:14:02 +00:00
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
if (flag & SEQ_RIGHTSEL) {
|
2010-10-16 14:32:17 +00:00
|
|
|
SeqToTransData(td++, td2d++, tdsq++, seq, flag, SEQ_RIGHTSEL);
|
2009-01-23 23:14:02 +00:00
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2010-10-16 14:32:17 +00:00
|
|
|
SeqToTransData(td++, td2d++, tdsq++, seq, flag, SELECT);
|
2009-01-23 23:14:02 +00:00
|
|
|
tot++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return tot;
|
|
|
|
}
|
|
|
|
|
2009-10-19 08:01:30 +00:00
|
|
|
static void freeSeqData(TransInfo *t)
|
|
|
|
{
|
|
|
|
Editing *ed= seq_give_editing(t->scene, FALSE);
|
|
|
|
|
2009-10-19 10:07:19 +00:00
|
|
|
if(ed != NULL) {
|
|
|
|
ListBase *seqbasep= ed->seqbasep;
|
2009-10-19 08:01:30 +00:00
|
|
|
TransData *td= t->data;
|
2009-10-19 10:07:19 +00:00
|
|
|
int a;
|
2009-10-19 08:01:30 +00:00
|
|
|
|
|
|
|
/* prevent updating the same seq twice
|
|
|
|
* if the transdata order is changed this will mess up
|
|
|
|
* but so will TransDataSeq */
|
|
|
|
Sequence *seq_prev= NULL;
|
2009-10-19 10:07:19 +00:00
|
|
|
Sequence *seq;
|
|
|
|
|
2009-10-19 08:01:30 +00:00
|
|
|
|
2009-10-19 10:07:19 +00:00
|
|
|
if (!(t->state == TRANS_CANCEL)) {
|
|
|
|
|
2009-10-22 14:40:32 +00:00
|
|
|
#if 0 // default 2.4 behavior
|
|
|
|
|
2009-10-19 10:07:19 +00:00
|
|
|
/* flush to 2d vector from internally used 3d vector */
|
|
|
|
for(a=0; a<t->total; a++, td++) {
|
|
|
|
if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
|
2009-10-22 14:40:32 +00:00
|
|
|
seq= ((TransDataSeq *)td->extra)->seq;
|
2009-10-19 10:07:19 +00:00
|
|
|
shuffle_seq(seqbasep, seq);
|
|
|
|
}
|
|
|
|
|
|
|
|
seq_prev= seq;
|
2009-10-19 08:01:30 +00:00
|
|
|
}
|
|
|
|
|
2009-10-22 14:40:32 +00:00
|
|
|
#else // durian hack
|
|
|
|
{
|
|
|
|
int overlap= 0;
|
|
|
|
|
|
|
|
for(a=0; a<t->total; a++, td++) {
|
|
|
|
seq_prev= NULL;
|
|
|
|
seq= ((TransDataSeq *)td->extra)->seq;
|
|
|
|
if ((seq != seq_prev) && (seq->depth==0) && (seq->flag & SEQ_OVERLAP)) {
|
|
|
|
overlap= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
seq_prev= seq;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(overlap) {
|
2011-06-07 16:47:25 +00:00
|
|
|
int has_effect= 0;
|
2009-10-22 14:40:32 +00:00
|
|
|
for(seq= seqbasep->first; seq; seq= seq->next)
|
|
|
|
seq->tmp= NULL;
|
|
|
|
|
|
|
|
td= t->data;
|
|
|
|
seq_prev= NULL;
|
|
|
|
for(a=0; a<t->total; a++, td++) {
|
|
|
|
seq= ((TransDataSeq *)td->extra)->seq;
|
|
|
|
if ((seq != seq_prev)) {
|
2011-06-07 16:47:25 +00:00
|
|
|
/* check effects strips, we cant change their time */
|
|
|
|
if((seq->type & SEQ_EFFECT) && seq->seq1) {
|
|
|
|
has_effect= TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Tag seq with a non zero value, used by shuffle_seq_time to identify the ones to shuffle */
|
|
|
|
seq->tmp= (void*)1;
|
|
|
|
}
|
2009-10-22 14:40:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-21 16:57:39 +00:00
|
|
|
shuffle_seq_time(seqbasep, t->scene);
|
2011-06-07 16:47:25 +00:00
|
|
|
|
|
|
|
if(has_effect) {
|
|
|
|
/* update effects strips based on strips just moved in time */
|
|
|
|
td= t->data;
|
|
|
|
seq_prev= NULL;
|
|
|
|
for(a=0; a<t->total; a++, td++) {
|
|
|
|
seq= ((TransDataSeq *)td->extra)->seq;
|
|
|
|
if ((seq != seq_prev)) {
|
|
|
|
if((seq->type & SEQ_EFFECT) && seq->seq1) {
|
|
|
|
calc_sequence(t->scene, seq);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now if any effects _still_ overlap, we need to move them up */
|
|
|
|
td= t->data;
|
|
|
|
seq_prev= NULL;
|
|
|
|
for(a=0; a<t->total; a++, td++) {
|
|
|
|
seq= ((TransDataSeq *)td->extra)->seq;
|
|
|
|
if ((seq != seq_prev)) {
|
|
|
|
if((seq->type & SEQ_EFFECT) && seq->seq1) {
|
|
|
|
if(seq_test_overlap(seqbasep, seq)) {
|
|
|
|
shuffle_seq(seqbasep, seq, t->scene);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* done with effects */
|
|
|
|
}
|
2009-10-22 14:40:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-10-19 10:07:19 +00:00
|
|
|
for(seq= seqbasep->first; seq; seq= seq->next) {
|
|
|
|
/* We might want to build a list of effects that need to be updated during transform */
|
|
|
|
if(seq->type & SEQ_EFFECT) {
|
2010-02-07 23:41:17 +00:00
|
|
|
if (seq->seq1 && seq->seq1->flag & SELECT) calc_sequence(t->scene, seq);
|
|
|
|
else if (seq->seq2 && seq->seq2->flag & SELECT) calc_sequence(t->scene, seq);
|
|
|
|
else if (seq->seq3 && seq->seq3->flag & SELECT) calc_sequence(t->scene, seq);
|
2009-10-19 10:07:19 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-19 08:01:30 +00:00
|
|
|
|
2009-10-19 10:07:19 +00:00
|
|
|
sort_seq(t->scene);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Cancelled, need to update the strips display */
|
|
|
|
for(a=0; a<t->total; a++, td++) {
|
|
|
|
seq= ((TransDataSeq *)td->extra)->seq;
|
|
|
|
if ((seq != seq_prev) && (seq->depth==0)) {
|
2010-02-07 23:41:17 +00:00
|
|
|
calc_sequence_disp(t->scene, seq);
|
2009-10-19 10:07:19 +00:00
|
|
|
}
|
|
|
|
seq_prev= seq;
|
2009-10-19 08:01:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t->customData) {
|
|
|
|
MEM_freeN(t->customData);
|
|
|
|
t->customData= NULL;
|
|
|
|
}
|
|
|
|
if (t->data) {
|
|
|
|
MEM_freeN(t->data); // XXX postTrans usually does this
|
|
|
|
t->data= NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
static void createTransSeqData(bContext *C, TransInfo *t)
|
|
|
|
{
|
2011-06-16 12:48:25 +00:00
|
|
|
#define XXX_DURIAN_ANIM_TX_HACK
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
View2D *v2d= UI_view2d_fromcontext(C);
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene= t->scene;
|
2009-01-28 22:36:34 +00:00
|
|
|
Editing *ed= seq_give_editing(t->scene, FALSE);
|
2009-01-21 07:01:20 +00:00
|
|
|
TransData *td = NULL;
|
|
|
|
TransData2D *td2d= NULL;
|
|
|
|
TransDataSeq *tdsq= NULL;
|
|
|
|
|
|
|
|
int count=0;
|
|
|
|
|
2009-01-28 22:36:34 +00:00
|
|
|
if (ed==NULL) {
|
|
|
|
t->total= 0;
|
|
|
|
return;
|
|
|
|
}
|
2009-01-24 05:38:25 +00:00
|
|
|
|
2009-10-19 08:01:30 +00:00
|
|
|
t->customFree= freeSeqData;
|
|
|
|
|
2009-01-24 05:38:25 +00:00
|
|
|
/* which side of the current frame should be allowed */
|
|
|
|
if (t->mode == TFM_TIME_EXTEND) {
|
|
|
|
/* only side on which mouse is gets transformed */
|
|
|
|
float xmouse, ymouse;
|
|
|
|
|
|
|
|
UI_view2d_region_to_view(v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
|
|
|
|
t->frame_side = (xmouse > CFRA) ? 'R' : 'L';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* normal transform - both sides of current frame are considered */
|
|
|
|
t->frame_side = 'B';
|
|
|
|
}
|
|
|
|
|
2011-06-16 12:48:25 +00:00
|
|
|
#ifdef XXX_DURIAN_ANIM_TX_HACK
|
|
|
|
{
|
|
|
|
Sequence *seq;
|
|
|
|
for(seq= ed->seqbasep->first; seq; seq= seq->next) {
|
|
|
|
/* hack */
|
|
|
|
if((seq->flag & SELECT)==0 && seq->type & SEQ_EFFECT) {
|
|
|
|
Sequence *seq_user;
|
|
|
|
int i;
|
|
|
|
for(i=0; i<3; i++) {
|
|
|
|
seq_user= *((&seq->seq1) + i);
|
|
|
|
if (seq_user && (seq_user->flag & SELECT) && !(seq_user->flag & SEQ_LOCK) && !(seq_user->flag & (SEQ_LEFTSEL|SEQ_RIGHTSEL))) {
|
|
|
|
seq->flag |= SELECT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2009-01-24 05:38:25 +00:00
|
|
|
|
|
|
|
count = SeqTransCount(t, ed->seqbasep, 0);
|
2009-01-21 07:01:20 +00:00
|
|
|
|
2009-01-26 09:13:15 +00:00
|
|
|
/* allocate memory for data */
|
|
|
|
t->total= count;
|
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
/* stop if trying to build list if nothing selected */
|
|
|
|
if (count == 0) {
|
|
|
|
return;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransSeq TransData");
|
|
|
|
td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransSeq TransData2D");
|
|
|
|
tdsq = t->customData= MEM_callocN(t->total*sizeof(TransDataSeq), "TransSeq TransDataSeq");
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
/* loop 2: build transdata array */
|
2009-01-24 05:38:25 +00:00
|
|
|
SeqToTransData_Recursive(t, ed->seqbasep, td, td2d, tdsq);
|
2011-06-16 12:48:25 +00:00
|
|
|
|
|
|
|
#undef XXX_DURIAN_ANIM_TX_HACK
|
2009-01-21 07:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-20 20:51:38 +00:00
|
|
|
/* *********************** Object Transform data ******************* */
|
|
|
|
|
|
|
|
/* Little helper function for ObjectToTransData used to give certain
|
|
|
|
* constraints (ChildOf, FollowPath, and others that may be added)
|
|
|
|
* inverse corrections for transform, so that they aren't in CrazySpace.
|
|
|
|
* These particular constraints benefit from this, but others don't, hence
|
|
|
|
* this semi-hack ;-) - Aligorith
|
|
|
|
*/
|
|
|
|
static short constraints_list_needinv(TransInfo *t, ListBase *list)
|
|
|
|
{
|
|
|
|
bConstraint *con;
|
|
|
|
|
|
|
|
/* loop through constraints, checking if there's one of the mentioned
|
|
|
|
* constraints needing special crazyspace corrections
|
|
|
|
*/
|
|
|
|
if (list) {
|
|
|
|
for (con= list->first; con; con=con->next) {
|
|
|
|
/* only consider constraint if it is enabled, and has influence on result */
|
2011-03-28 17:06:15 +00:00
|
|
|
if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0f)) {
|
2011-01-20 20:51:38 +00:00
|
|
|
/* (affirmative) returns for specific constraints here... */
|
|
|
|
/* constraints that require this regardless */
|
|
|
|
if (con->type == CONSTRAINT_TYPE_CHILDOF) return 1;
|
|
|
|
if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) return 1;
|
|
|
|
if (con->type == CONSTRAINT_TYPE_CLAMPTO) return 1;
|
|
|
|
|
|
|
|
/* constraints that require this only under special conditions */
|
|
|
|
if (con->type == CONSTRAINT_TYPE_ROTLIKE) {
|
|
|
|
/* CopyRot constraint only does this when rotating, and offset is on */
|
|
|
|
bRotateLikeConstraint *data = (bRotateLikeConstraint *)con->data;
|
|
|
|
|
|
|
|
if ((data->flag & ROTLIKE_OFFSET) && (t->mode == TFM_ROTATION))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no appropriate candidates found */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* transcribe given object into TransData for Transforming */
|
2010-10-16 14:32:17 +00:00
|
|
|
static void ObjectToTransData(TransInfo *t, TransData *td, Object *ob)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene = t->scene;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float obmtx[3][3];
|
|
|
|
short constinv;
|
|
|
|
short skip_invert = 0;
|
|
|
|
|
|
|
|
/* axismtx has the real orientation */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(td->axismtx, ob->obmat);
|
|
|
|
normalize_m3(td->axismtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->con= ob->constraints.first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
/* hack: tempolarily disable tracking and/or constraints when getting
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* object matrix, if tracking is on, or if constraints don't need
|
|
|
|
* inverse correction to stop it from screwing up space conversion
|
|
|
|
* matrix later
|
|
|
|
*/
|
|
|
|
constinv = constraints_list_needinv(t, &ob->constraints);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* disable constraints inversion for dummy pass */
|
|
|
|
if (t->mode == TFM_DUMMY)
|
|
|
|
skip_invert = 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-03-26 02:57:49 +00:00
|
|
|
if (skip_invert == 0 && constinv == 0) {
|
2010-01-12 19:51:26 +00:00
|
|
|
if (constinv == 0)
|
|
|
|
ob->transflag |= OB_NO_CONSTRAINTS; /* where_is_object_time checks this */
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_object(t->scene, ob);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-01-12 19:51:26 +00:00
|
|
|
if (constinv == 0)
|
|
|
|
ob->transflag &= ~OB_NO_CONSTRAINTS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else
|
2009-01-04 14:14:06 +00:00
|
|
|
where_is_object(t->scene, ob);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
td->ob = ob;
|
|
|
|
|
|
|
|
td->loc = ob->loc;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-10-22 02:14:11 +00:00
|
|
|
if (ob->rotmode > 0) {
|
|
|
|
td->ext->rot= ob->rot;
|
|
|
|
td->ext->rotAxis= NULL;
|
|
|
|
td->ext->rotAngle= NULL;
|
|
|
|
td->ext->quat= NULL;
|
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->irot, ob->rot);
|
|
|
|
copy_v3_v3(td->ext->drot, ob->drot);
|
2009-10-22 02:14:11 +00:00
|
|
|
}
|
|
|
|
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
|
|
|
|
td->ext->rot= NULL;
|
|
|
|
td->ext->rotAxis= ob->rotAxis;
|
|
|
|
td->ext->rotAngle= &ob->rotAngle;
|
|
|
|
td->ext->quat= NULL;
|
|
|
|
|
|
|
|
td->ext->irotAngle= ob->rotAngle;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->irotAxis, ob->rotAxis);
|
2010-10-19 11:15:08 +00:00
|
|
|
// td->ext->drotAngle= ob->drotAngle; // XXX, not implimented
|
2011-09-12 04:14:12 +00:00
|
|
|
// copy_v3_v3(td->ext->drotAxis, ob->drotAxis); // XXX, not implimented
|
2009-10-22 02:14:11 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
td->ext->rot= NULL;
|
|
|
|
td->ext->rotAxis= NULL;
|
|
|
|
td->ext->rotAngle= NULL;
|
|
|
|
td->ext->quat= ob->quat;
|
|
|
|
|
2011-10-28 12:40:15 +00:00
|
|
|
copy_qt_qt(td->ext->iquat, ob->quat);
|
|
|
|
copy_qt_qt(td->ext->dquat, ob->dquat);
|
2009-10-22 02:14:11 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
td->ext->rotOrder=ob->rotmode;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->ext->size = ob->size;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->isize, ob->size);
|
|
|
|
copy_v3_v3(td->ext->dsize, ob->dsize);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, ob->obmat[3]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(td->ext->obmat, ob->obmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* is there a need to set the global<->data space conversion matrices? */
|
|
|
|
if (ob->parent || constinv) {
|
|
|
|
float totmat[3][3], obinv[3][3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Get the effect of parenting, and/or certain constraints.
|
|
|
|
* NOTE: some Constraints, and also Tracking should never get this
|
|
|
|
* done, as it doesn't work well.
|
|
|
|
*/
|
|
|
|
object_to_mat3(ob, obmtx);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(totmat, ob->obmat);
|
|
|
|
invert_m3_m3(obinv, totmat);
|
|
|
|
mul_m3_m3m3(td->smtx, obmtx, obinv);
|
|
|
|
invert_m3_m3(td->mtx, td->smtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* no conversion to/from dataspace */
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->smtx);
|
|
|
|
unit_m3(td->mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* set active flag */
|
|
|
|
if (ob == OBACT)
|
|
|
|
{
|
|
|
|
td->flag |= TD_ACTIVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* sets flags in Bases to define whether they take part in transform */
|
|
|
|
/* it deselects Bases, so we have to call the clear function always after */
|
2010-10-16 14:32:17 +00:00
|
|
|
static void set_trans_object_base_flags(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-10-30 17:48:50 +00:00
|
|
|
Scene *scene = t->scene;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
View3D *v3d = t->view;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/*
|
|
|
|
if Base selected and has parent selected:
|
|
|
|
base->flag= BA_WAS_SEL
|
|
|
|
*/
|
|
|
|
Base *base;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* don't do it if we're not actually going to recalculate anything */
|
|
|
|
if(t->mode == TFM_DUMMY)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* makes sure base flags and object flags are identical */
|
2009-01-04 14:14:06 +00:00
|
|
|
copy_baseflags(t->scene);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* handle pending update events, otherwise they got copied below */
|
2009-09-21 09:17:14 +00:00
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if(base->object->recalc)
|
2009-01-04 14:14:06 +00:00
|
|
|
object_handle_update(t->scene, base->object);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-21 09:17:14 +00:00
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
base->flag &= ~BA_WAS_SEL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-30 17:48:50 +00:00
|
|
|
if(TESTBASELIB_BGMODE(v3d, scene, base)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
Object *ob= base->object;
|
|
|
|
Object *parsel= ob->parent;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if parent selected, deselect */
|
|
|
|
while(parsel) {
|
2010-08-14 17:11:10 +00:00
|
|
|
if(parsel->flag & SELECT) {
|
|
|
|
Base *parbase = object_in_scene(parsel, scene);
|
2010-11-10 05:46:17 +00:00
|
|
|
if(parbase) { /* in rare cases this can fail */
|
|
|
|
if TESTBASELIB_BGMODE(v3d, scene, parbase) {
|
2010-08-14 17:11:10 +00:00
|
|
|
break;
|
2010-11-10 05:46:17 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-14 17:11:10 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
parsel= parsel->parent;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(parsel)
|
|
|
|
{
|
2009-10-30 17:48:50 +00:00
|
|
|
/* rotation around local centers are allowed to propagate */
|
|
|
|
if ((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
base->flag |= BA_TRANSFORM_CHILD;
|
2009-10-30 17:48:50 +00:00
|
|
|
} else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
base->flag &= ~SELECT;
|
|
|
|
base->flag |= BA_WAS_SEL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* used for flush, depgraph will change recalcs if needed :) */
|
|
|
|
ob->recalc |= OB_RECALC_OB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* all recalc flags get flushed to all layers, so a layer flip later on works fine */
|
2010-08-01 12:47:49 +00:00
|
|
|
DAG_scene_flush_update(G.main, t->scene, -1, 0);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* and we store them temporal in base (only used for transform code) */
|
|
|
|
/* this because after doing updates, the object->recalc is cleared */
|
2009-09-21 09:17:14 +00:00
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(base->object->recalc & OB_RECALC_OB)
|
|
|
|
base->flag |= BA_HAS_RECALC_OB;
|
|
|
|
if(base->object->recalc & OB_RECALC_DATA)
|
|
|
|
base->flag |= BA_HAS_RECALC_DATA;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-30 17:48:50 +00:00
|
|
|
static int mark_children(Object *ob)
|
|
|
|
{
|
|
|
|
if (ob->flag & (SELECT|BA_TRANSFORM_CHILD))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (ob->parent)
|
|
|
|
{
|
|
|
|
if (mark_children(ob->parent))
|
|
|
|
{
|
|
|
|
ob->flag |= BA_TRANSFORM_CHILD;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int count_proportional_objects(TransInfo *t)
|
|
|
|
{
|
|
|
|
int total = 0;
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
View3D *v3d = t->view;
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
/* rotations around local centers are allowed to propagate, so we take all objects */
|
|
|
|
if (!((t->mode == TFM_ROTATION || t->mode == TFM_TRACKBALL) && t->around == V3D_LOCAL))
|
|
|
|
{
|
|
|
|
/* mark all parents */
|
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
|
|
|
if(TESTBASELIB_BGMODE(v3d, scene, base)) {
|
|
|
|
Object *parent = base->object->parent;
|
|
|
|
|
|
|
|
/* flag all parents */
|
|
|
|
while(parent) {
|
|
|
|
parent->flag |= BA_TRANSFORM_PARENT;
|
|
|
|
parent = parent->parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mark all children */
|
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
|
|
|
/* all base not already selected or marked that is editable */
|
|
|
|
if ((base->object->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
|
|
|
|
{
|
|
|
|
mark_children(base->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
|
|
|
Object *ob= base->object;
|
|
|
|
|
|
|
|
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
|
|
|
|
if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
|
|
|
|
{
|
|
|
|
|
|
|
|
/* used for flush, depgraph will change recalcs if needed :) */
|
|
|
|
ob->recalc |= OB_RECALC_OB;
|
|
|
|
|
|
|
|
total += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* all recalc flags get flushed to all layers, so a layer flip later on works fine */
|
2010-08-01 12:47:49 +00:00
|
|
|
DAG_scene_flush_update(G.main, t->scene, -1, 0);
|
2009-10-30 17:48:50 +00:00
|
|
|
|
|
|
|
/* and we store them temporal in base (only used for transform code) */
|
|
|
|
/* this because after doing updates, the object->recalc is cleared */
|
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
|
|
|
if(base->object->recalc & OB_RECALC_OB)
|
|
|
|
base->flag |= BA_HAS_RECALC_OB;
|
|
|
|
if(base->object->recalc & OB_RECALC_DATA)
|
|
|
|
base->flag |= BA_HAS_RECALC_DATA;
|
|
|
|
}
|
|
|
|
|
|
|
|
return total;
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
static void clear_trans_object_base_flags(TransInfo *t)
|
|
|
|
{
|
|
|
|
Scene *sce = t->scene;
|
|
|
|
Base *base;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (base= sce->base.first; base; base = base->next)
|
|
|
|
{
|
|
|
|
if(base->flag & BA_WAS_SEL)
|
|
|
|
base->flag |= SELECT;
|
|
|
|
|
2010-05-21 12:17:34 +00:00
|
|
|
base->flag &= ~(BA_WAS_SEL|BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA|BA_TEMP_TAG|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* auto-keyframing feature - for objects
|
|
|
|
* tmode: should be a transform mode
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2009-12-14 03:20:17 +00:00
|
|
|
// NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
|
|
|
|
void autokeyframe_ob_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-02-16 03:01:56 +00:00
|
|
|
ID *id= &ob->id;
|
|
|
|
FCurve *fcu;
|
2009-10-27 23:21:26 +00:00
|
|
|
|
2009-07-12 02:06:15 +00:00
|
|
|
// TODO: this should probably be done per channel instead...
|
|
|
|
if (autokeyframe_cfra_can_key(scene, id)) {
|
2010-11-17 12:02:36 +00:00
|
|
|
ReportList *reports = CTX_wm_reports(C);
|
2009-10-08 06:39:45 +00:00
|
|
|
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ListBase dsources = {NULL, NULL};
|
2009-02-16 03:01:56 +00:00
|
|
|
float cfra= (float)CFRA; // xxx this will do for now
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
short flag = 0;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
/* get flags used for inserting keyframes */
|
2009-12-14 12:09:20 +00:00
|
|
|
flag = ANIM_get_keyframing_flags(scene, 1);
|
2009-10-08 06:39:45 +00:00
|
|
|
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
/* add datasource override for the camera object */
|
|
|
|
ANIM_relative_keyingset_add_source(&dsources, id, NULL, NULL);
|
|
|
|
|
2011-02-04 08:33:07 +00:00
|
|
|
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) {
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
/* only insert into active keyingset
|
|
|
|
* NOTE: we assume here that the active Keying Set does not need to have its iterator overridden spe
|
|
|
|
*/
|
2010-04-07 11:27:59 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
2009-10-08 06:39:45 +00:00
|
|
|
}
|
2011-02-04 08:33:07 +00:00
|
|
|
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
|
2009-10-08 05:53:26 +00:00
|
|
|
AnimData *adt= ob->adt;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only key on available channels */
|
2009-02-16 03:01:56 +00:00
|
|
|
if (adt && adt->action) {
|
|
|
|
for (fcu= adt->action->curves.first; fcu; fcu= fcu->next) {
|
|
|
|
fcu->flag &= ~FCURVE_SELECTED;
|
2010-11-17 12:02:36 +00:00
|
|
|
insert_keyframe(reports, id, adt->action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-02-04 08:33:07 +00:00
|
|
|
else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
short doLoc=0, doRot=0, doScale=0;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
|
|
|
|
if (tmode == TFM_TRANSLATION) {
|
|
|
|
doLoc = 1;
|
|
|
|
}
|
|
|
|
else if (tmode == TFM_ROTATION) {
|
2009-02-16 03:01:56 +00:00
|
|
|
if (v3d->around == V3D_ACTIVE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ob != OBACT)
|
|
|
|
doLoc = 1;
|
|
|
|
}
|
2009-02-16 03:01:56 +00:00
|
|
|
else if (v3d->around == V3D_CURSOR)
|
2009-07-12 02:01:13 +00:00
|
|
|
doLoc = 1;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if ((v3d->flag & V3D_ALIGN)==0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doRot = 1;
|
|
|
|
}
|
|
|
|
else if (tmode == TFM_RESIZE) {
|
2009-02-16 03:01:56 +00:00
|
|
|
if (v3d->around == V3D_ACTIVE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ob != OBACT)
|
|
|
|
doLoc = 1;
|
|
|
|
}
|
2009-02-16 03:01:56 +00:00
|
|
|
else if (v3d->around == V3D_CURSOR)
|
2009-07-12 02:01:13 +00:00
|
|
|
doLoc = 1;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2009-02-16 03:01:56 +00:00
|
|
|
if ((v3d->flag & V3D_ALIGN)==0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doScale = 1;
|
|
|
|
}
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2009-10-08 05:53:26 +00:00
|
|
|
/* insert keyframes for the affected sets of channels using the builtin KeyingSets found */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (doLoc) {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
if (doRot) {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
if (doScale) {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-08 05:53:26 +00:00
|
|
|
/* insert keyframe in all (transform) channels */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
|
|
|
|
/* free temp info */
|
|
|
|
BLI_freelistN(&dsources);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* auto-keyframing feature - for poses/pose-channels
|
|
|
|
* tmode: should be a transform mode
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* targetless_ik: has targetless ik been done on any channels?
|
|
|
|
*/
|
2009-12-14 03:20:17 +00:00
|
|
|
// NOTE: context may not always be available, so must check before using it as it's a luxury for a few cases
|
|
|
|
void autokeyframe_pose_cb_func(bContext *C, Scene *scene, View3D *v3d, Object *ob, int tmode, short targetless_ik)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-02-16 03:01:56 +00:00
|
|
|
ID *id= &ob->id;
|
|
|
|
AnimData *adt= ob->adt;
|
|
|
|
bAction *act= (adt) ? adt->action : NULL;
|
|
|
|
bPose *pose= ob->pose;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bPoseChannel *pchan;
|
2009-02-16 03:01:56 +00:00
|
|
|
FCurve *fcu;
|
2009-10-27 23:21:26 +00:00
|
|
|
|
2009-07-12 02:06:15 +00:00
|
|
|
// TODO: this should probably be done per channel instead...
|
|
|
|
if (autokeyframe_cfra_can_key(scene, id)) {
|
2010-11-17 12:02:36 +00:00
|
|
|
ReportList *reports = CTX_wm_reports(C);
|
2009-10-08 06:39:45 +00:00
|
|
|
KeyingSet *active_ks = ANIM_scene_get_active_keyingset(scene);
|
2009-02-16 03:01:56 +00:00
|
|
|
float cfra= (float)CFRA;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
short flag= 0;
|
2009-10-08 05:53:26 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* flag is initialised from UserPref keyframing settings
|
2009-02-17 10:58:40 +00:00
|
|
|
* - special exception for targetless IK - INSERTKEY_MATRIX keyframes should get
|
|
|
|
* visual keyframes even if flag not set, as it's not that useful otherwise
|
|
|
|
* (for quick animation recording)
|
|
|
|
*/
|
2009-12-14 12:09:20 +00:00
|
|
|
flag = ANIM_get_keyframing_flags(scene, 1);
|
|
|
|
|
|
|
|
if (targetless_ik)
|
2009-02-17 10:58:40 +00:00
|
|
|
flag |= INSERTKEY_MATRIX;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
if (pchan->bone->flag & BONE_TRANSFORM) {
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ListBase dsources = {NULL, NULL};
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* clear any 'unkeyed' flag it may have */
|
|
|
|
pchan->bone->flag &= ~BONE_UNKEYED;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
/* add datasource override for the camera object */
|
|
|
|
ANIM_relative_keyingset_add_source(&dsources, id, &RNA_PoseBone, pchan);
|
|
|
|
|
2009-10-08 06:39:45 +00:00
|
|
|
/* only insert into active keyingset? */
|
2011-02-04 08:33:07 +00:00
|
|
|
if (IS_AUTOKEY_FLAG(scene, ONLYKEYINGSET) && (active_ks)) {
|
2010-04-07 11:27:59 +00:00
|
|
|
/* run the active Keying Set on the current datasource */
|
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, active_ks, MODIFYKEY_MODE_INSERT, cfra);
|
2009-10-08 06:39:45 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only insert into available channels? */
|
2011-02-04 08:33:07 +00:00
|
|
|
else if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL)) {
|
2009-02-16 03:01:56 +00:00
|
|
|
if (act) {
|
2010-02-21 11:42:32 +00:00
|
|
|
for (fcu= act->curves.first; fcu; fcu= fcu->next) {
|
|
|
|
/* only insert keyframes for this F-Curve if it affects the current bone */
|
|
|
|
if (strstr(fcu->rna_path, "bones")) {
|
|
|
|
char *pchanName= BLI_getQuotedStr(fcu->rna_path, "bones[");
|
|
|
|
|
|
|
|
/* only if bone name matches too...
|
|
|
|
* NOTE: this will do constraints too, but those are ok to do here too?
|
|
|
|
*/
|
|
|
|
if (pchanName && strcmp(pchanName, pchan->name) == 0)
|
2010-11-17 12:02:36 +00:00
|
|
|
insert_keyframe(reports, id, act, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
|
2010-02-21 11:42:32 +00:00
|
|
|
|
|
|
|
if (pchanName) MEM_freeN(pchanName);
|
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* only insert keyframe if needed? */
|
2011-02-04 08:33:07 +00:00
|
|
|
else if (IS_AUTOKEY_FLAG(scene, INSERTNEEDED)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
short doLoc=0, doRot=0, doScale=0;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
|
|
|
|
if (tmode == TFM_TRANSLATION) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if (targetless_ik)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doRot= 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doLoc = 1;
|
|
|
|
}
|
|
|
|
else if (tmode == TFM_ROTATION) {
|
2009-02-16 03:01:56 +00:00
|
|
|
if (ELEM(v3d->around, V3D_CURSOR, V3D_ACTIVE))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doLoc = 1;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if ((v3d->flag & V3D_ALIGN)==0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doRot = 1;
|
|
|
|
}
|
|
|
|
else if (tmode == TFM_RESIZE) {
|
2009-02-16 03:01:56 +00:00
|
|
|
if (ELEM(v3d->around, V3D_CURSOR, V3D_ACTIVE))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doLoc = 1;
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2009-02-16 03:01:56 +00:00
|
|
|
if ((v3d->flag & V3D_ALIGN)==0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
doScale = 1;
|
|
|
|
}
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (doLoc) {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOCATION_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
if (doRot) {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_ROTATION_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
if (doScale) {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_SCALING_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-08 05:53:26 +00:00
|
|
|
/* insert keyframe in all (transform) channels */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else {
|
2011-10-23 05:08:02 +00:00
|
|
|
KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_LOC_ROT_SCALE_ID);
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
ANIM_apply_keyingset(C, &dsources, NULL, ks, MODIFYKEY_MODE_INSERT, cfra);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
2010-03-16 06:18:49 +00:00
|
|
|
|
|
|
|
/* free temp info */
|
|
|
|
BLI_freelistN(&dsources);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-04 04:27:06 +00:00
|
|
|
|
2009-12-14 03:20:17 +00:00
|
|
|
/* do the bone paths
|
2010-03-11 11:15:25 +00:00
|
|
|
* - only do this when there is context info, since we need that to resolve
|
|
|
|
* how to do the updates and so on...
|
|
|
|
* - do not calculate unless there are paths already to update...
|
2009-12-14 03:20:17 +00:00
|
|
|
*/
|
2010-03-11 11:15:25 +00:00
|
|
|
if (C && (ob->pose->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)) {
|
2010-01-19 21:44:22 +00:00
|
|
|
//ED_pose_clear_paths(C, ob); // XXX for now, don't need to clear
|
2010-10-15 03:24:47 +00:00
|
|
|
ED_pose_recalculate_paths(scene, ob);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* tag channels that should have unkeyed data */
|
|
|
|
for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
if (pchan->bone->flag & BONE_TRANSFORM) {
|
|
|
|
/* tag this channel */
|
|
|
|
pchan->bone->flag |= BONE_UNKEYED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-14 03:20:17 +00:00
|
|
|
/* inserting keys, pointcache, redraw events... */
|
2009-11-01 02:52:38 +00:00
|
|
|
/*
|
|
|
|
* note: sequencer freeing has its own function now because of a conflict with transform's order of freeing (campbell)
|
|
|
|
* Order changed, the sequencer stuff should go back in here
|
|
|
|
* */
|
2009-12-14 03:20:17 +00:00
|
|
|
void special_aftertrans_update(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
Object *ob;
|
2009-01-02 19:10:35 +00:00
|
|
|
// short redrawipo=0, resetslowpar=1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int cancelled= (t->state == TRANS_CANCEL);
|
2011-03-02 23:39:08 +00:00
|
|
|
short duplicate= (t->mode == TFM_TIME_DUPLICATE);
|
2009-10-27 23:21:26 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
/* early out when nothing happened */
|
2009-11-01 20:09:03 +00:00
|
|
|
if (t->total == 0 || t->mode == TFM_DUMMY)
|
2009-11-01 02:52:38 +00:00
|
|
|
return;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->spacetype==SPACE_VIEW3D) {
|
2008-12-31 22:43:29 +00:00
|
|
|
if (t->obedit) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (cancelled==0) {
|
2009-10-08 15:50:42 +00:00
|
|
|
EM_automerge(t->scene, t->obedit, 1);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-27 23:21:26 +00:00
|
|
|
|
|
|
|
if (t->spacetype == SPACE_SEQ) {
|
2009-10-19 17:20:09 +00:00
|
|
|
/* freeSeqData in transform_conversions.c does this
|
|
|
|
* keep here so the else at the end wont run... */
|
2010-03-16 18:01:22 +00:00
|
|
|
|
|
|
|
SpaceSeq *sseq= (SpaceSeq *)t->sa->spacedata.first;
|
|
|
|
|
|
|
|
/* marker transform, not especially nice but we may want to move markers
|
|
|
|
* at the same time as keyframes in the dope sheet. */
|
|
|
|
if ((sseq->flag & SEQ_MARKER_TRANS) && (cancelled == 0)) {
|
|
|
|
/* cant use , TFM_TIME_EXTEND
|
|
|
|
* for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */
|
|
|
|
|
|
|
|
if(t->mode == TFM_SEQ_SLIDE) {
|
|
|
|
if(t->frame_side == 'B')
|
2011-10-03 02:49:08 +00:00
|
|
|
ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_TRANSLATE, t->values[0], t->frame_side);
|
2010-03-16 18:01:22 +00:00
|
|
|
}
|
|
|
|
else if (ELEM(t->frame_side, 'L', 'R')) {
|
2011-10-03 02:49:08 +00:00
|
|
|
ED_markers_post_apply_transform(&t->scene->markers, t->scene, TFM_TIME_EXTEND, t->values[0], t->frame_side);
|
2010-03-16 18:01:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-19 17:20:09 +00:00
|
|
|
}
|
2009-11-02 16:55:06 +00:00
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
2011-09-05 21:01:50 +00:00
|
|
|
SpaceNode *snode= (SpaceNode *)t->sa->spacedata.first;
|
|
|
|
ED_node_update_hierarchy(C, snode->edittree);
|
|
|
|
|
2011-07-22 15:28:50 +00:00
|
|
|
if(cancelled == 0)
|
|
|
|
ED_node_link_insert(t->sa);
|
|
|
|
|
|
|
|
/* clear link line */
|
|
|
|
ED_node_link_intersect_test(t->sa, 0);
|
2009-11-02 16:55:06 +00:00
|
|
|
}
|
2009-01-21 07:01:20 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2008-12-29 06:06:59 +00:00
|
|
|
bAnimContext ac;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-12-14 03:20:17 +00:00
|
|
|
/* initialise relevant anim-context 'context' data */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
2008-12-30 00:28:11 +00:00
|
|
|
return;
|
2009-12-14 03:20:17 +00:00
|
|
|
|
|
|
|
ob = ac.obact;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-12-14 03:20:17 +00:00
|
|
|
if (ELEM(ac.datatype, ANIMCONT_DOPESHEET, ANIMCONT_SHAPEKEY)) {
|
2008-12-29 06:06:59 +00:00
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
/* get channels to work on */
|
2009-01-26 04:13:38 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-12-06 09:37:31 +00:00
|
|
|
/* these should all be F-Curves */
|
2008-12-29 06:06:59 +00:00
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2011-03-02 23:39:08 +00:00
|
|
|
/* 3 cases here for curve cleanups:
|
|
|
|
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
|
|
|
|
* 2) cancelled == 0 -> user confirmed the transform, so duplicates should be removed
|
|
|
|
* 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
|
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
2010-03-22 09:30:00 +00:00
|
|
|
((cancelled == 0) || (duplicate)) )
|
2008-12-29 06:06:59 +00:00
|
|
|
{
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt) {
|
2010-01-15 10:34:39 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 1);
|
2011-09-29 05:03:21 +00:00
|
|
|
posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */
|
2010-01-15 10:34:39 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 1);
|
2008-12-29 06:06:59 +00:00
|
|
|
}
|
|
|
|
else
|
2011-09-29 05:03:21 +00:00
|
|
|
posttrans_fcurve_clean(fcu, FALSE); /* only use handles in graph editor */
|
2008-12-29 06:06:59 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
/* free temp memory */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
}
|
2009-12-14 03:20:17 +00:00
|
|
|
else if (ac.datatype == ANIMCONT_ACTION) { // TODO: just integrate into the above...
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Depending on the lock status, draw necessary views */
|
2008-12-29 06:06:59 +00:00
|
|
|
// fixme... some of this stuff is not good
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (ob) {
|
2008-12-29 06:06:59 +00:00
|
|
|
if (ob->pose || ob_get_key(ob))
|
2010-12-17 15:51:42 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2011-03-02 23:39:08 +00:00
|
|
|
/* 3 cases here for curve cleanups:
|
|
|
|
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
|
|
|
|
* 2) cancelled == 0 -> user confirmed the transform, so duplicates should be removed
|
|
|
|
* 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
|
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
2010-03-22 09:30:00 +00:00
|
|
|
((cancelled == 0) || (duplicate)) )
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2008-12-29 06:06:59 +00:00
|
|
|
posttrans_action_clean(&ac, (bAction *)ac.data);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (ac.datatype == ANIMCONT_GPENCIL) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* remove duplicate frames and also make sure points are in order! */
|
2011-03-02 23:39:08 +00:00
|
|
|
/* 3 cases here for curve cleanups:
|
|
|
|
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
|
|
|
|
* 2) cancelled == 0 -> user confirmed the transform, so duplicates should be removed
|
|
|
|
* 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
|
|
|
|
*/
|
|
|
|
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
|
|
|
((cancelled == 0) || (duplicate)) )
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2011-01-10 22:10:28 +00:00
|
|
|
bGPdata *gpd;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
// XXX: BAD! this get gpencil datablocks directly from main db...
|
|
|
|
// but that's how this currently works :/
|
|
|
|
for (gpd = G.main->gpencil.first; gpd; gpd = gpd->id.next) {
|
2011-07-05 01:54:01 +00:00
|
|
|
if (ID_REAL_USERS(gpd))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
posttrans_gpd_clean(gpd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2011-03-14 10:45:42 +00:00
|
|
|
/* marker transform, not especially nice but we may want to move markers
|
|
|
|
* at the same time as keyframes in the dope sheet.
|
|
|
|
*/
|
|
|
|
if ((saction->flag & SACTION_MARKERS_MOVE) && (cancelled == 0)) {
|
|
|
|
if (t->mode == TFM_TIME_TRANSLATE) {
|
2011-05-01 10:14:09 +00:00
|
|
|
#if 0
|
|
|
|
if (ELEM(t->frame_side, 'L', 'R')) { /* TFM_TIME_EXTEND */
|
|
|
|
/* same as below */
|
2011-10-03 02:49:08 +00:00
|
|
|
ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side);
|
2011-05-01 10:14:09 +00:00
|
|
|
}
|
2011-03-14 10:45:42 +00:00
|
|
|
else /* TFM_TIME_TRANSLATE */
|
2011-05-01 10:14:09 +00:00
|
|
|
#endif
|
|
|
|
{
|
2011-10-03 02:49:08 +00:00
|
|
|
ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side);
|
2011-05-01 10:14:09 +00:00
|
|
|
}
|
2011-03-14 10:45:42 +00:00
|
|
|
}
|
|
|
|
else if (t->mode == TFM_TIME_SCALE) {
|
2011-10-03 02:49:08 +00:00
|
|
|
ED_markers_post_apply_transform(ED_context_get_markers(C), t->scene, t->mode, t->values[0], t->frame_side);
|
2011-03-14 10:45:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* make sure all F-Curves are set correctly */
|
2011-07-05 01:54:01 +00:00
|
|
|
if (ac.datatype != ANIMCONT_GPENCIL)
|
|
|
|
ANIM_editkeyframes_refresh(&ac);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
/* clear flag that was set for time-slide drawing */
|
|
|
|
saction->flag &= ~SACTION_MOVING;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-01-27 11:09:30 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
|
|
|
|
bAnimContext ac;
|
2011-09-29 05:03:21 +00:00
|
|
|
const short use_handle = !(sipo->flag & SIPO_NOHANDLES);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-12-14 03:20:17 +00:00
|
|
|
/* initialise relevant anim-context 'context' data */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
2009-01-27 11:09:30 +00:00
|
|
|
return;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if (ac.datatype)
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* get channels to work on */
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
2009-06-23 13:25:31 +00:00
|
|
|
AnimData *adt= ANIM_nla_mapping_get(&ac, ale);
|
2009-01-27 11:09:30 +00:00
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2011-03-02 23:39:08 +00:00
|
|
|
/* 3 cases here for curve cleanups:
|
|
|
|
* 1) NOTRANSKEYCULL on -> cleanup of duplicates shouldn't be done
|
|
|
|
* 2) cancelled == 0 -> user confirmed the transform, so duplicates should be removed
|
|
|
|
* 3) cancelled + duplicate -> user cancelled the transform, but we made duplicates, so get rid of these
|
|
|
|
*/
|
2009-07-12 02:01:13 +00:00
|
|
|
if ( (sipo->flag & SIPO_NOTRANSKEYCULL)==0 &&
|
2010-03-22 09:30:00 +00:00
|
|
|
((cancelled == 0) || (duplicate)) )
|
2009-01-27 11:09:30 +00:00
|
|
|
{
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt) {
|
2011-03-09 15:04:09 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, fcu, 0, 0);
|
2011-09-29 05:03:21 +00:00
|
|
|
posttrans_fcurve_clean(fcu, use_handle);
|
2011-03-09 15:04:09 +00:00
|
|
|
ANIM_nla_mapping_apply_fcurve(adt, fcu, 1, 0);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
else
|
2011-09-29 05:03:21 +00:00
|
|
|
posttrans_fcurve_clean(fcu, use_handle);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-01-27 11:09:30 +00:00
|
|
|
/* free temp memory */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
}
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2010-09-24 09:54:28 +00:00
|
|
|
/* Make sure all F-Curves are set correctly, but not if transform was
|
|
|
|
* canceled, since then curves were already restored to initial state.
|
|
|
|
* Note: if the refresh is really needed after cancel then some way
|
|
|
|
* has to be added to not update handle types (see bug 22289).
|
|
|
|
*/
|
|
|
|
if(!cancelled)
|
|
|
|
ANIM_editkeyframes_refresh(&ac);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
|
|
|
bAnimContext ac;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-12-14 03:20:17 +00:00
|
|
|
/* initialise relevant anim-context 'context' data */
|
|
|
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
2009-06-09 11:26:45 +00:00
|
|
|
return;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if (ac.datatype)
|
2009-07-07 02:12:50 +00:00
|
|
|
{
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
Animation Channel Filtering Refactor - Part 3 (Visibility Flag Split)
* This (big) commit is aimed at cleaning up the filtering flags used
by the animation channel filtering code. The list of filtering flags
has been growing a bit "organically" since it's humble origins for use
in the Action Editor some 3 years (IIRC) ago now during a weekend
hackathon. Obviously, some things have ended up tacked on, while
others have been the product of other flag options. Nevertheless, it
was time for a bit of a spring clean!
* Most notably, one area where the system outgrown its original design
for the Action Editor was in terms of the "visibility" filtering flag
it was using. While in the Action Editor the concept of what channels
to include was strictly dictated by whether the channel hierarchy
showed it, in the Graph Editor this is not always the case. In other
words, there was a difference between the data the channels
represented being visible and the channels for that data being visible
in the hierarchy.
Long story short: this lead to bug report [#27076] (and many like it),
where if you selected an F-Curve, then collapsed the Group it was in,
then even after selecting another F-Curve in another Group, the
original F-Curve's properties would still be shown in the Properties
Region. The good news is that this commit fixes this issue right away!
* More good news will follow, as I start checking on the flag usage of
other tools, but I'm committing this first so that we have a stable
reference (of code similar to the old buggy stuff) on which we can
fall back to later to find bugs (should they pop up).
Anyways, back to the trenches!
2011-06-22 11:41:26 +00:00
|
|
|
short filter= (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-07-24 06:51:33 +00:00
|
|
|
/* get channels to work on */
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
|
|
|
NlaTrack *nlt= (NlaTrack *)ale->data;
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-07-24 06:51:33 +00:00
|
|
|
/* make sure strips are in order again */
|
|
|
|
BKE_nlatrack_sort_strips(nlt);
|
2009-07-24 06:08:03 +00:00
|
|
|
|
2009-07-24 06:51:33 +00:00
|
|
|
/* remove the temp metas */
|
|
|
|
BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
|
2009-07-24 06:08:03 +00:00
|
|
|
}
|
|
|
|
|
2009-07-24 06:51:33 +00:00
|
|
|
/* free temp memory */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
|
2009-07-24 06:08:03 +00:00
|
|
|
/* perform after-transfrom validation */
|
2009-07-24 06:51:33 +00:00
|
|
|
ED_nla_postop_refresh(&ac);
|
2009-07-07 02:12:50 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-01-04 19:11:56 +00:00
|
|
|
else if (t->obedit) {
|
|
|
|
if (t->obedit->type == OB_MESH)
|
|
|
|
{
|
|
|
|
EditMesh *em = ((Mesh *)t->obedit->data)->edit_mesh;
|
|
|
|
/* table needs to be created for each edit command, since vertices can move etc */
|
|
|
|
mesh_octree_table(t->obedit, em, NULL, 'e');
|
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else if ((t->flag & T_POSE) && (t->poseobj)) {
|
|
|
|
bArmature *arm;
|
|
|
|
bPoseChannel *pchan;
|
|
|
|
short targetless_ik= 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
ob= t->poseobj;
|
|
|
|
arm= ob->data;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-02-23 04:03:58 +00:00
|
|
|
if((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
|
|
|
|
/* when running transform non-interactively (operator exec),
|
|
|
|
* we need to update the pose otherwise no updates get called during
|
|
|
|
* transform and the auto-ik is not applied. see [#26164] */
|
2011-05-23 08:14:29 +00:00
|
|
|
struct Object *pose_ob=t->poseobj;
|
|
|
|
where_is_pose(t->scene, pose_ob);
|
2011-02-23 04:03:58 +00:00
|
|
|
}
|
|
|
|
|
2011-07-10 18:21:40 +00:00
|
|
|
/* set BONE_TRANSFORM flags for autokey, manipulator draw might have changed them */
|
|
|
|
if (!cancelled && (t->mode != TFM_DUMMY))
|
|
|
|
count_set_pose_transflags(&t->mode, t->around, ob);
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
|
|
|
|
if (!cancelled && t->mode==TFM_TRANSLATION)
|
|
|
|
targetless_ik= apply_targetless_ik(ob);
|
|
|
|
else {
|
|
|
|
/* not forget to clear the auto flag */
|
|
|
|
for (pchan=ob->pose->chanbase.first; pchan; pchan=pchan->next) {
|
|
|
|
bKinematicConstraint *data= has_targetless_ik(pchan);
|
|
|
|
if(data) data->flag &= ~CONSTRAINT_IK_AUTO;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->mode==TFM_TRANSLATION)
|
|
|
|
pose_grab_with_ik_clear(ob);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */
|
|
|
|
if (!cancelled && (t->mode != TFM_DUMMY)) {
|
2009-12-14 03:20:17 +00:00
|
|
|
autokeyframe_pose_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else if (arm->flag & ARM_DELAYDEFORM) {
|
|
|
|
/* old optimize trick... this enforces to bypass the depgraph */
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
ob->recalc= 0; // is set on OK position already by recalcData()
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-09-28 14:51:42 +00:00
|
|
|
else if(t->scene->basact && (ob = t->scene->basact->object) && (ob->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, ob)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
;
|
|
|
|
}
|
2009-11-01 02:52:38 +00:00
|
|
|
else { /* Objects */
|
2010-01-19 21:44:22 +00:00
|
|
|
int i, recalcObPaths=0;
|
2009-09-13 23:58:03 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
for (i = 0; i < t->total; i++) {
|
|
|
|
TransData *td = t->data + i;
|
|
|
|
ListBase pidlist;
|
|
|
|
PTCacheID *pid;
|
2010-12-03 12:30:59 +00:00
|
|
|
ob = td->ob;
|
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* flag object caches as outdated */
|
2010-03-30 12:23:13 +00:00
|
|
|
BKE_ptcache_ids_from_object(&pidlist, ob, t->scene, MAX_DUPLI_RECUR);
|
2009-11-01 02:52:38 +00:00
|
|
|
for(pid=pidlist.first; pid; pid=pid->next) {
|
|
|
|
if(pid->type != PTCACHE_TYPE_PARTICLES) /* particles don't need reset on geometry change */
|
|
|
|
pid->cache->flag |= PTCACHE_OUTDATED;
|
|
|
|
}
|
|
|
|
BLI_freelistN(&pidlist);
|
Pointcache refresh part 2
* Based on what happens during simulation the cache is marked (also in cache panel, this could possibly be extended to 3d view as well) as:
- exact (not marked)
- outdated (simulation is not done completely with current settings)
- non-exact (frames were skipped during simulation)
* The parameter "cache step" effects the number of frames between saved cache frames.
- This can save a lot of memory (or disk space) if absolutely frame accurate simulation is not required.
- Speeds up the "quick caching" very much.
- Frames between cached frames are interpolated from the cached frames.
- Current default value of 10 frames works nicely with up/down-arrows (skip 10 frames forwards/backwards on timeline), but can be changed if wanted.
* The caching can work in normal or "quick" mode:
[Normal cache]
- Basic: Calculate what even happens (settings change, big frame steps etc.) and cache results, if possible try to use "cache step" when saving cache frames.
- Becomes non-exact: After larger than 1 frame steps.
- Becomes outdated: After any change effecting the simulation other than frame steps.
- Pros/cons: Freedom of doing anything and playing with particles, but exact results have to calculated from the beginning.
[Quick cache]
- Basic: Calculate simulation up to current frame automatically on changes with cache step sized jumps in simulation. With multiple "quick cached" simulations the smallest cache step is used.
- Becomes non-exact: Always from frame 1 (unless cache step = 1).
- Becomes outdated: Never.
- Pros/cons: Not very accurate, but super fast!
- Todo: Transform of any animated (non-autokeyed) object is locked! Probably needs some tinkering with anim sys overrides.
* The simulation can be run forwards or backwards even if it's cache is outdated or non-exact, the following rules apply in these situations:
- step forwards (to unknown) -> simulate from last exact frame, store result
- step backwards (to known) -> result is interpolated from existing frames, store result, clear cache forwards if current frame is after last exact frame
* "Calculate to current frame" runs the simulation from start to current frame with a frame steps of 1.
- Baking does the same, but runs the simulation all the way to the end of simulation.
- Rendering does this automatically if the simulation is outdated of non-exact, so all rendered simulations will always be updated and exact.
* Every cache panel also holds buttons to "Bake all dynamics", "Free all dynamics" and "Update all dynamics to current frame".
* Cloth simulation supports the new cache too.
2009-06-27 15:28:58 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
/* pointcache refresh */
|
|
|
|
if (BKE_ptcache_object_reset(t->scene, ob, PTCACHE_RESET_OUTDATED))
|
|
|
|
ob->recalc |= OB_RECALC_DATA;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
/* Needed for proper updating of "quick cached" dynamics. */
|
|
|
|
/* Creates troubles for moving animated objects without */
|
|
|
|
/* autokey though, probably needed is an anim sys override? */
|
|
|
|
/* Please remove if some other solution is found. -jahka */
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
2009-10-27 23:21:26 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
/* Set autokey if necessary */
|
2010-01-19 21:44:22 +00:00
|
|
|
if (!cancelled) {
|
2009-12-14 03:20:17 +00:00
|
|
|
autokeyframe_ob_cb_func(C, t->scene, (View3D *)t->view, ob, t->mode);
|
2010-01-19 21:44:22 +00:00
|
|
|
|
2010-03-11 11:15:25 +00:00
|
|
|
/* only calculate paths if there are paths to be recalculated */
|
|
|
|
if (ob->avs.path_bakeflag & MOTIONPATH_BAKE_HAS_PATHS)
|
2010-01-19 21:44:22 +00:00
|
|
|
recalcObPaths= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* recalculate motion paths for objects (if necessary)
|
|
|
|
* NOTE: only do this when there is context info
|
|
|
|
*/
|
|
|
|
if (C && recalcObPaths) {
|
|
|
|
//ED_objects_clear_paths(C); // XXX for now, don't need to clear
|
|
|
|
ED_objects_recalculate_paths(C, t->scene);
|
2010-11-03 23:49:56 +00:00
|
|
|
|
|
|
|
/* recalculating the frame positions means we loose our original transform if its not auto-keyed [#24451]
|
|
|
|
* this hack re-applies it, which is annoying, only alternatives are...
|
|
|
|
* - dont recalc paths.
|
|
|
|
* - have an object_handle_update() which gives is the new transform without touching the objects.
|
|
|
|
* - only recalc paths on auto-keying.
|
|
|
|
* - ED_objects_recalculate_paths could backup/restore transforms.
|
|
|
|
* - re-apply the transform which is simplest in this case. (2 lines below)
|
|
|
|
*/
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
transformApply(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-02-16 03:01:56 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
clear_trans_object_base_flags(t);
|
|
|
|
|
2009-12-17 17:50:55 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
|
|
|
if(resetslowpar)
|
|
|
|
reset_slowparents();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void createTransObject(bContext *C, TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td = NULL;
|
|
|
|
TransDataExtension *tx;
|
2009-10-30 17:48:50 +00:00
|
|
|
int propmode = t->flag & T_PROP_EDIT;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
set_trans_object_base_flags(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* count */
|
2009-08-15 16:36:25 +00:00
|
|
|
t->total= CTX_DATA_COUNT(C, selected_objects);
|
2009-10-30 17:48:50 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(!t->total) {
|
|
|
|
/* clear here, main transform function escapes too */
|
|
|
|
clear_trans_object_base_flags(t);
|
|
|
|
return;
|
|
|
|
}
|
2009-10-30 17:48:50 +00:00
|
|
|
|
|
|
|
if (propmode)
|
|
|
|
{
|
|
|
|
t->total += count_proportional_objects(t);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransOb");
|
|
|
|
tx = t->ext = MEM_callocN(t->total*sizeof(TransDataExtension), "TransObExtension");
|
|
|
|
|
2009-01-11 18:27:41 +00:00
|
|
|
CTX_DATA_BEGIN(C, Base*, base, selected_bases)
|
|
|
|
{
|
|
|
|
Object *ob= base->object;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-11 18:27:41 +00:00
|
|
|
td->flag = TD_SELECTED;
|
|
|
|
td->protectflag= ob->protectflag;
|
|
|
|
td->ext = tx;
|
2010-11-14 19:19:58 +00:00
|
|
|
td->ext->rotOrder= ob->rotmode;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-11 18:27:41 +00:00
|
|
|
if (base->flag & BA_TRANSFORM_CHILD)
|
|
|
|
{
|
|
|
|
td->flag |= TD_NOCENTER;
|
|
|
|
td->flag |= TD_NO_LOC;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-11 18:27:41 +00:00
|
|
|
/* select linked objects, but skip them later */
|
2011-03-03 17:59:04 +00:00
|
|
|
if (ob->id.lib != NULL) {
|
2009-01-11 18:27:41 +00:00
|
|
|
td->flag |= TD_SKIP;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
ObjectToTransData(t, td, ob);
|
2009-09-28 10:19:20 +00:00
|
|
|
td->val = NULL;
|
|
|
|
td++;
|
|
|
|
tx++;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-01-11 18:27:41 +00:00
|
|
|
CTX_DATA_END;
|
2009-10-30 17:48:50 +00:00
|
|
|
|
|
|
|
if (propmode)
|
|
|
|
{
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
View3D *v3d = t->view;
|
|
|
|
Base *base;
|
|
|
|
|
|
|
|
for (base= scene->base.first; base; base= base->next) {
|
|
|
|
Object *ob= base->object;
|
|
|
|
|
|
|
|
/* if base is not selected, not a parent of selection or not a child of selection and it is editable */
|
|
|
|
if ((ob->flag & (SELECT|BA_TRANSFORM_CHILD|BA_TRANSFORM_PARENT)) == 0 && BASE_EDITABLE_BGMODE(v3d, scene, base))
|
|
|
|
{
|
|
|
|
td->protectflag= ob->protectflag;
|
|
|
|
td->ext = tx;
|
2010-11-14 19:19:58 +00:00
|
|
|
td->ext->rotOrder= ob->rotmode;
|
2009-10-30 17:48:50 +00:00
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
ObjectToTransData(t, td, ob);
|
2009-10-30 17:48:50 +00:00
|
|
|
td->val = NULL;
|
|
|
|
td++;
|
|
|
|
tx++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2009-01-02 23:58:03 +00:00
|
|
|
/* transcribe given node into TransData2D for Transforming */
|
2009-01-04 01:08:01 +00:00
|
|
|
static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
|
2009-07-12 02:01:13 +00:00
|
|
|
// static void NodeToTransData(bContext *C, TransInfo *t, TransData2D *td, bNode *node)
|
2009-01-02 23:58:03 +00:00
|
|
|
{
|
2009-01-04 01:08:01 +00:00
|
|
|
td2d->loc[0] = node->locx; /* hold original location */
|
|
|
|
td2d->loc[1] = node->locy;
|
|
|
|
td2d->loc[2] = 0.0f;
|
|
|
|
td2d->loc2d = &node->locx; /* current location */
|
|
|
|
|
|
|
|
td->flag = 0;
|
2011-09-05 21:01:50 +00:00
|
|
|
/* exclude nodes whose parent is also transformed */
|
|
|
|
if (node->parent && (node->parent->flag & NODE_TRANSFORM)) {
|
|
|
|
td->flag |= TD_SKIP;
|
|
|
|
}
|
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
td->loc = td2d->loc;
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->center, td->loc);
|
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2009-01-04 01:08:01 +00:00
|
|
|
|
|
|
|
memset(td->axismtx, 0, sizeof(td->axismtx));
|
|
|
|
td->axismtx[2][2] = 1.0f;
|
|
|
|
|
2009-09-28 10:19:20 +00:00
|
|
|
td->ext= NULL; td->val= NULL;
|
2009-01-04 01:08:01 +00:00
|
|
|
|
|
|
|
td->flag |= TD_SELECTED;
|
|
|
|
td->dist= 0.0;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(td->mtx);
|
|
|
|
unit_m3(td->smtx);
|
2009-01-02 23:58:03 +00:00
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void createTransNodeData(bContext *C, TransInfo *t)
|
2009-01-02 23:58:03 +00:00
|
|
|
{
|
2009-01-04 01:08:01 +00:00
|
|
|
TransData *td;
|
|
|
|
TransData2D *td2d;
|
2011-09-05 21:01:50 +00:00
|
|
|
SpaceNode *snode= t->sa->spacedata.first;
|
|
|
|
bNode *node;
|
|
|
|
|
2011-09-26 08:51:02 +00:00
|
|
|
if(!snode->edittree) {
|
|
|
|
t->total= 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-09-05 21:01:50 +00:00
|
|
|
/* set transform flags on nodes */
|
|
|
|
for (node=snode->edittree->nodes.first; node; node=node->next) {
|
|
|
|
if ((node->flag & NODE_SELECT) || (node->parent && (node->parent->flag & NODE_TRANSFORM)))
|
|
|
|
node->flag |= NODE_TRANSFORM;
|
|
|
|
else
|
|
|
|
node->flag &= ~NODE_TRANSFORM;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-17 00:51:42 +00:00
|
|
|
t->total= CTX_DATA_COUNT(C, selected_nodes);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransNode TransData");
|
|
|
|
td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransNode TransData2D");
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-02 23:58:03 +00:00
|
|
|
CTX_DATA_BEGIN(C, bNode *, selnode, selected_nodes)
|
2009-01-04 01:08:01 +00:00
|
|
|
NodeToTransData(td++, td2d++, selnode);
|
2009-01-02 23:58:03 +00:00
|
|
|
CTX_DATA_END
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void createTransData(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2010-03-08 09:06:58 +00:00
|
|
|
Scene *scene = t->scene;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
Object *ob = OBACT;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-01-09 20:42:35 +00:00
|
|
|
if (t->options & CTX_TEXTURE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_TEXTURE;
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransTexspace(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2010-01-09 20:42:35 +00:00
|
|
|
else if (t->options & CTX_EDGE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->ext = NULL;
|
|
|
|
t->flag |= T_EDIT;
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransEdge(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(t->data && t->flag & T_PROP_EDIT) {
|
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->options == CTX_BMESH) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
// TRANSFORM_FIX_ME
|
|
|
|
//createTransBMeshVerts(t, G.editBMesh->bm, G.editBMesh->td);
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
t->flag |= T_POINTS|T_2D_EDIT;
|
|
|
|
createTransUVs(C, t);
|
|
|
|
if(t->data && (t->flag & T_PROP_EDIT)) {
|
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
|
|
|
t->flag |= T_POINTS|T_2D_EDIT;
|
|
|
|
createTransActionData(C, t);
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
|
|
|
t->flag |= T_POINTS|T_2D_EDIT;
|
2009-06-09 11:26:45 +00:00
|
|
|
createTransNlaData(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-01-21 07:01:20 +00:00
|
|
|
else if (t->spacetype == SPACE_SEQ) {
|
|
|
|
t->flag |= T_POINTS|T_2D_EDIT;
|
|
|
|
t->num.flag |= NUM_NO_FRACTION; /* sequencer has no use for floating point transformations */
|
|
|
|
createTransSeqData(C, t);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
t->flag |= T_POINTS|T_2D_EDIT;
|
2009-01-27 11:09:30 +00:00
|
|
|
createTransGraphEditData(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
#if 0
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->data && (t->flag & T_PROP_EDIT)) {
|
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
#endif
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-01-02 23:58:03 +00:00
|
|
|
else if(t->spacetype == SPACE_NODE) {
|
|
|
|
t->flag |= T_2D_EDIT|T_POINTS;
|
|
|
|
createTransNodeData(C, t);
|
2009-01-04 18:16:34 +00:00
|
|
|
if (t->data && (t->flag & T_PROP_EDIT)) {
|
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
2009-01-02 23:58:03 +00:00
|
|
|
}
|
2008-12-31 22:43:29 +00:00
|
|
|
else if (t->obedit) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->ext = NULL;
|
2008-12-31 22:43:29 +00:00
|
|
|
if (t->obedit->type == OB_MESH) {
|
2009-07-12 02:01:13 +00:00
|
|
|
createTransEditVerts(C, t);
|
2011-09-25 12:31:21 +00:00
|
|
|
}
|
2008-12-31 22:43:29 +00:00
|
|
|
else if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
createTransCurveVerts(C, t);
|
|
|
|
}
|
2008-12-31 22:43:29 +00:00
|
|
|
else if (t->obedit->type==OB_LATTICE) {
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransLatticeVerts(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2008-12-31 22:43:29 +00:00
|
|
|
else if (t->obedit->type==OB_MBALL) {
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransMBallVerts(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2008-12-31 22:43:29 +00:00
|
|
|
else if (t->obedit->type==OB_ARMATURE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag &= ~T_PROP_EDIT;
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransArmatureVerts(t);
|
2011-09-25 12:31:21 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else {
|
|
|
|
printf("edit type not implemented!\n");
|
|
|
|
}
|
|
|
|
|
2009-10-30 17:48:50 +00:00
|
|
|
t->flag |= T_EDIT|T_POINTS;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(t->data && t->flag & T_PROP_EDIT) {
|
2008-12-31 22:43:29 +00:00
|
|
|
if (ELEM(t->obedit->type, OB_CURVE, OB_MESH)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 0);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* exception... hackish, we want bonesize to use bone orientation matrix (ton) */
|
|
|
|
if(t->mode==TFM_BONESIZE) {
|
|
|
|
t->flag &= ~(T_EDIT|T_POINTS);
|
|
|
|
t->flag |= T_POSE;
|
|
|
|
t->poseobj = ob; /* <- tsk tsk, this is going to give issues one day */
|
|
|
|
}
|
|
|
|
}
|
2009-08-16 03:24:23 +00:00
|
|
|
else if (ob && (ob->mode & OB_MODE_POSE)) {
|
2009-07-12 02:01:13 +00:00
|
|
|
// XXX this is currently limited to active armature only...
|
2009-01-24 10:03:19 +00:00
|
|
|
// XXX active-layer checking isn't done as that should probably be checked through context instead
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransPose(t, ob);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-08-15 21:46:25 +00:00
|
|
|
else if (ob && (ob->mode & OB_MODE_WEIGHT_PAINT)) {
|
2010-10-10 23:11:34 +00:00
|
|
|
/* important that ob_armature can be set even when its not selected [#23412]
|
|
|
|
* lines below just check is also visible */
|
|
|
|
Object *ob_armature= modifiers_isDeformedByArmature(ob);
|
|
|
|
if(ob_armature && ob_armature->mode & OB_MODE_POSE) {
|
|
|
|
Base *base_arm= object_in_scene(ob_armature, t->scene);
|
|
|
|
if(base_arm) {
|
|
|
|
View3D *v3d = t->view;
|
|
|
|
if(BASE_VISIBLE(v3d, base_arm)) {
|
2010-10-16 14:32:17 +00:00
|
|
|
createTransPose(t, ob_armature);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2010-10-10 23:11:34 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-08-29 15:20:36 +00:00
|
|
|
else if (ob && (ob->mode & OB_MODE_PARTICLE_EDIT)
|
|
|
|
&& PE_start_edit(PE_get_current(scene, ob))) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
createTransParticleVerts(C, t);
|
2009-10-30 17:48:50 +00:00
|
|
|
t->flag |= T_POINTS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
if(t->data && t->flag & T_PROP_EDIT) {
|
|
|
|
sort_trans_data(t); // makes selected become first in array
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
|
|
|
}
|
2010-12-19 12:38:20 +00:00
|
|
|
else if (ob && (ob->mode & (OB_MODE_SCULPT|OB_MODE_TEXTURE_PAINT))) {
|
|
|
|
/* sculpt mode and project paint have own undo stack
|
|
|
|
* transform ops redo clears sculpt/project undo stack.
|
|
|
|
*
|
|
|
|
* Could use 'OB_MODE_ALL_PAINT' since there are key conflicts,
|
|
|
|
* transform + paint isnt well supported. */
|
2010-12-19 09:41:41 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else {
|
|
|
|
createTransObject(C, t);
|
|
|
|
t->flag |= T_OBJECT;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-30 17:48:50 +00:00
|
|
|
if(t->data && t->flag & T_PROP_EDIT) {
|
|
|
|
// selected objects are already first, no need to presort
|
|
|
|
set_prop_dist(t, 1);
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
}
|
|
|
|
|
2011-05-18 09:58:17 +00:00
|
|
|
if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-03-28 20:46:38 +00:00
|
|
|
View3D *v3d = t->view;
|
2009-08-30 21:57:10 +00:00
|
|
|
RegionView3D *rv3d = CTX_wm_region_view3d(C);
|
2009-10-27 02:54:25 +00:00
|
|
|
if(rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
|
2009-03-28 20:46:38 +00:00
|
|
|
{
|
|
|
|
t->flag |= T_CAMERA;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TRANSFORM_FIX_ME
|
|
|
|
// /* temporal...? */
|
2009-01-04 14:14:06 +00:00
|
|
|
// t->scene->recalc |= SCE_PRV_CHANGED; /* test for 3d preview */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|