2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-12-12 23:30:23 +00:00
|
|
|
* 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.
|
2008-12-12 23:30:23 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup RNA
|
2011-02-27 20:20:01 +00:00
|
|
|
*/
|
|
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2010-01-25 06:24:05 +00:00
|
|
|
#include "BLI_math.h"
|
2018-07-15 20:39:02 +03:00
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
2010-01-25 06:24:05 +00:00
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2012-04-13 20:25:05 +00:00
|
|
|
|
2009-05-27 00:03:49 +00:00
|
|
|
#include "DNA_action_types.h"
|
2008-12-12 23:30:23 +00:00
|
|
|
#include "DNA_constraint_types.h"
|
2009-05-30 23:31:10 +00:00
|
|
|
#include "DNA_modifier_types.h"
|
2009-01-20 03:55:30 +00:00
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
#include "DNA_scene_types.h"
|
2008-12-12 23:30:23 +00:00
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "RNA_define.h"
|
2013-09-07 12:59:16 +00:00
|
|
|
#include "RNA_enum_types.h"
|
2013-03-07 02:44:55 +00:00
|
|
|
|
|
|
|
|
#include "rna_internal.h"
|
|
|
|
|
|
2009-05-27 00:03:49 +00:00
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
2013-03-07 02:44:55 +00:00
|
|
|
#include "ED_object.h"
|
|
|
|
|
|
2012-06-08 21:04:48 +00:00
|
|
|
/* please keep the names in sync with constraint.c */
|
2017-10-18 15:07:26 +11:00
|
|
|
const EnumPropertyItem rna_enum_constraint_type_items[] = {
|
2012-04-13 20:25:05 +00:00
|
|
|
{0, "", 0, N_("Motion Tracking"), ""},
|
2019-06-04 18:10:47 +02:00
|
|
|
{CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CON_CAMERASOLVER, "Camera Solver", ""},
|
|
|
|
|
{CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CON_FOLLOWTRACK, "Follow Track", ""},
|
|
|
|
|
{CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CON_OBJECTSOLVER, "Object Solver", ""},
|
2012-04-13 20:25:05 +00:00
|
|
|
{0, "", 0, N_("Transform"), ""},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_LOCLIKE,
|
|
|
|
|
"COPY_LOCATION",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_LOCLIKE,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Copy Location",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Copy the location of a target (with an optional offset), so that they move together"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_ROTLIKE,
|
|
|
|
|
"COPY_ROTATION",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_ROTLIKE,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Copy Rotation",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Copy the rotation of a target (with an optional offset), so that they rotate together"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_SIZELIKE,
|
|
|
|
|
"COPY_SCALE",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_SIZELIKE,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Copy Scale",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Copy the scale factors of a target (with an optional offset), so that they are scaled by "
|
|
|
|
|
"the same amount"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_TRANSLIKE,
|
|
|
|
|
"COPY_TRANSFORMS",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_TRANSLIKE,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Copy Transforms",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Copy all the transformations of a target, so that they move together"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_DISTLIMIT,
|
|
|
|
|
"LIMIT_DISTANCE",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_DISTLIMIT,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Limit Distance",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Restrict movements to within a certain distance of a target (at the time of constraint "
|
|
|
|
|
"evaluation only)"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_LOCLIMIT,
|
|
|
|
|
"LIMIT_LOCATION",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_LOCLIMIT,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Limit Location",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Restrict movement along each axis within given ranges"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_ROTLIMIT,
|
|
|
|
|
"LIMIT_ROTATION",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_ROTLIMIT,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Limit Rotation",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Restrict rotation along each axis within given ranges"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_SIZELIMIT,
|
|
|
|
|
"LIMIT_SCALE",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_SIZELIMIT,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Limit Scale",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Restrict scaling along each axis with given ranges"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_SAMEVOL,
|
|
|
|
|
"MAINTAIN_VOLUME",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_SAMEVOL,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Maintain Volume",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Compensate for scaling one axis by applying suitable scaling to the other two axes"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_TRANSFORM,
|
|
|
|
|
"TRANSFORM",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_TRANSFORM,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Transformation",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Use one transform property from target to control another (or same) property on owner"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_TRANSFORM_CACHE,
|
|
|
|
|
"TRANSFORM_CACHE",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_TRANSFORM_CACHE,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Transform Cache",
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
"Look up the transformation matrix from an external file"},
|
2012-04-13 20:25:05 +00:00
|
|
|
{0, "", 0, N_("Tracking"), ""},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_CLAMPTO,
|
|
|
|
|
"CLAMP_TO",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_CLAMPTO,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Clamp To",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Restrict movements to lie along a curve by remapping location along curve's longest axis"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_DAMPTRACK,
|
|
|
|
|
"DAMPED_TRACK",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_TRACKTO,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Damped Track",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Point towards a target by performing the smallest rotation necessary"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_KINEMATIC,
|
|
|
|
|
"IK",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_KINEMATIC,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Inverse Kinematics",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Control a chain of bones by specifying the endpoint target (Bones only)"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_LOCKTRACK,
|
|
|
|
|
"LOCKED_TRACK",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_LOCKTRACK,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Locked Track",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Rotate around the specified ('locked') axis to point towards a target"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_SPLINEIK,
|
|
|
|
|
"SPLINE_IK",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_SPLINEIK,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Spline IK",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Align chain of bones along a curve (Bones only)"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_STRETCHTO,
|
|
|
|
|
"STRETCH_TO",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_STRETCHTO,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Stretch To",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Stretch along Y-Axis to point towards a target"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_TRACKTO,
|
|
|
|
|
"TRACK_TO",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_TRACKTO,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Track To",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Legacy tracking constraint prone to twisting artifacts"},
|
2012-04-13 20:25:05 +00:00
|
|
|
{0, "", 0, N_("Relationship"), ""},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_ACTION,
|
|
|
|
|
"ACTION",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_ACTION,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Action",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Use transform property of target to look up pose for owner from an Action"},
|
2019-03-13 14:44:56 +01:00
|
|
|
{CONSTRAINT_TYPE_ARMATURE,
|
|
|
|
|
"ARMATURE",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_ARMATURE,
|
2019-03-13 14:44:56 +01:00
|
|
|
"Armature",
|
|
|
|
|
"Apply weight-blended transformation from multiple bones like the Armature modifier"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_CHILDOF,
|
|
|
|
|
"CHILD_OF",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_CHILDOF,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Child Of",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Make target the 'detachable' parent of owner"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_MINMAX,
|
|
|
|
|
"FLOOR",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_FLOOR,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Floor",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Use position (and optionally rotation) of target to define a 'wall' or 'floor' that the "
|
|
|
|
|
"owner can not cross"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_FOLLOWPATH,
|
|
|
|
|
"FOLLOW_PATH",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_FOLLOWPATH,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Follow Path",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Use to animate an object/bone following a path"},
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_PIVOT,
|
|
|
|
|
"PIVOT",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_PIVOT,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Pivot",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Change pivot point for transforms (buggy)"},
|
2019-04-18 07:21:26 +02:00
|
|
|
#if 0
|
|
|
|
|
{CONSTRAINT_TYPE_RIGIDBODYJOINT,
|
|
|
|
|
"RIGID_BODY_JOINT",
|
|
|
|
|
ICON_CONSTRAINT_DATA,
|
|
|
|
|
"Rigid Body Joint",
|
|
|
|
|
"Use to define a Rigid Body Constraint (for Game Engine use only)"},
|
|
|
|
|
{CONSTRAINT_TYPE_PYTHON,
|
|
|
|
|
"SCRIPT",
|
|
|
|
|
ICON_CONSTRAINT_DATA,
|
|
|
|
|
"Script",
|
|
|
|
|
"Custom constraint(s) written in Python (Not yet implemented)"},
|
|
|
|
|
#endif
|
2018-10-01 10:45:50 +02:00
|
|
|
{CONSTRAINT_TYPE_SHRINKWRAP,
|
|
|
|
|
"SHRINKWRAP",
|
2019-06-04 18:10:47 +02:00
|
|
|
ICON_CON_SHRINKWRAP,
|
2018-10-01 10:45:50 +02:00
|
|
|
"Shrinkwrap",
|
2013-03-17 03:45:15 +00:00
|
|
|
"Restrict movements to surface of target mesh"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-05-27 00:03:49 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem target_space_pchan_items[] = {
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_WORLD,
|
|
|
|
|
"WORLD",
|
|
|
|
|
0,
|
|
|
|
|
"World Space",
|
|
|
|
|
"The transformation of the target is evaluated relative to the world "
|
|
|
|
|
"coordinate system"},
|
2020-12-03 10:42:29 +01:00
|
|
|
{CONSTRAINT_SPACE_CUSTOM,
|
|
|
|
|
"CUSTOM",
|
|
|
|
|
0,
|
|
|
|
|
"Custom Space",
|
|
|
|
|
"The transformation of the target is evaluated relative to a custom object/bone/vertex "
|
|
|
|
|
"group"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_POSE,
|
|
|
|
|
"POSE",
|
|
|
|
|
0,
|
|
|
|
|
"Pose Space",
|
|
|
|
|
"The transformation of the target is only evaluated in the Pose Space, "
|
|
|
|
|
"the target armature object transformation is ignored"},
|
|
|
|
|
{CONSTRAINT_SPACE_PARLOCAL,
|
|
|
|
|
"LOCAL_WITH_PARENT",
|
|
|
|
|
0,
|
|
|
|
|
"Local With Parent",
|
2019-04-14 16:26:47 +03:00
|
|
|
"The transformation of the target bone is evaluated relative to its rest pose "
|
|
|
|
|
"local coordinate system, thus including the parent-induced transformation"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_LOCAL,
|
|
|
|
|
"LOCAL",
|
|
|
|
|
0,
|
|
|
|
|
"Local Space",
|
|
|
|
|
"The transformation of the target is evaluated relative to its local "
|
|
|
|
|
"coordinate system"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2011-05-15 17:59:48 +00:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem owner_space_pchan_items[] = {
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_WORLD,
|
|
|
|
|
"WORLD",
|
|
|
|
|
0,
|
|
|
|
|
"World Space",
|
|
|
|
|
"The constraint is applied relative to the world coordinate system"},
|
2020-12-03 10:42:29 +01:00
|
|
|
{CONSTRAINT_SPACE_CUSTOM,
|
|
|
|
|
"CUSTOM",
|
|
|
|
|
0,
|
|
|
|
|
"Custom Space",
|
|
|
|
|
"The constraint is applied in local space of a custom object/bone/vertex group"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_POSE,
|
|
|
|
|
"POSE",
|
|
|
|
|
0,
|
|
|
|
|
"Pose Space",
|
|
|
|
|
"The constraint is applied in Pose Space, the object transformation is ignored"},
|
|
|
|
|
{CONSTRAINT_SPACE_PARLOCAL,
|
|
|
|
|
"LOCAL_WITH_PARENT",
|
|
|
|
|
0,
|
|
|
|
|
"Local With Parent",
|
2019-04-14 16:26:47 +03:00
|
|
|
"The constraint is applied relative to the rest pose local coordinate system "
|
|
|
|
|
"of the bone, thus including the parent-induced transformation"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_LOCAL,
|
|
|
|
|
"LOCAL",
|
|
|
|
|
0,
|
|
|
|
|
"Local Space",
|
2012-07-03 17:20:21 +00:00
|
|
|
"The constraint is applied relative to the local coordinate system of the object"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
RNA
* Enums can now be dynamically created in the _itemf callback,
using RNA_enum_item(s)_add, RNA_enum_item_end. All places asking
for enum items now need to potentially free the items.
* This callback now also gets context, this was added specifically
for operators. This doesn't fit design well at all, needed to do
some ugly hacks, but can't find a good solution at the moment.
* All enums must have a default list of items too, even with an
_itemf callback, for docs and fallback in case there is no context.
* Used by MESH_OT_merge, MESH_OT_select_similar, TFM_OT_select_orientation.
* Also changes some operator properties that were enums to booleas
(unselected, deselect), to make them consistent with other ops.
2009-07-10 19:56:13 +00:00
|
|
|
|
2018-10-03 19:09:43 +03:00
|
|
|
static const EnumPropertyItem track_axis_items[] = {
|
|
|
|
|
{TRACK_X, "TRACK_X", 0, "X", ""},
|
|
|
|
|
{TRACK_Y, "TRACK_Y", 0, "Y", ""},
|
|
|
|
|
{TRACK_Z, "TRACK_Z", 0, "Z", ""},
|
|
|
|
|
{TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
|
|
|
|
|
{TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
|
|
|
|
|
{TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2018-10-03 19:09:43 +03:00
|
|
|
};
|
|
|
|
|
|
2019-09-01 13:19:11 +03:00
|
|
|
static const EnumPropertyItem euler_order_items[] = {
|
|
|
|
|
{CONSTRAINT_EULER_AUTO, "AUTO", 0, "Default", "Euler using the default rotation order"},
|
|
|
|
|
{CONSTRAINT_EULER_XYZ, "XYZ", 0, "XYZ Euler", "Euler using the XYZ rotation order"},
|
|
|
|
|
{CONSTRAINT_EULER_XZY, "XZY", 0, "XZY Euler", "Euler using the XZY rotation order"},
|
|
|
|
|
{CONSTRAINT_EULER_YXZ, "YXZ", 0, "YXZ Euler", "Euler using the YXZ rotation order"},
|
|
|
|
|
{CONSTRAINT_EULER_YZX, "YZX", 0, "YZX Euler", "Euler using the YZX rotation order"},
|
|
|
|
|
{CONSTRAINT_EULER_ZXY, "ZXY", 0, "ZXY Euler", "Euler using the ZXY rotation order"},
|
|
|
|
|
{CONSTRAINT_EULER_ZYX, "ZYX", 0, "ZYX Euler", "Euler using the ZYX rotation order"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
2011-04-03 23:11:00 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem space_object_items[] = {
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_WORLD,
|
|
|
|
|
"WORLD",
|
|
|
|
|
0,
|
|
|
|
|
"World Space",
|
|
|
|
|
"The transformation of the target is evaluated relative to the world coordinate system"},
|
2020-12-03 10:42:29 +01:00
|
|
|
{CONSTRAINT_SPACE_CUSTOM,
|
|
|
|
|
"CUSTOM",
|
|
|
|
|
0,
|
|
|
|
|
"Custom Space",
|
|
|
|
|
"The transformation of the target is evaluated relative to a custom object/bone/vertex "
|
|
|
|
|
"group"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPACE_LOCAL,
|
|
|
|
|
"LOCAL",
|
|
|
|
|
0,
|
|
|
|
|
"Local Space",
|
|
|
|
|
"The transformation of the target is evaluated relative to its local coordinate system"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-05-27 00:03:49 +00:00
|
|
|
|
2016-10-29 12:23:09 +02:00
|
|
|
# include "DNA_cachefile_types.h"
|
|
|
|
|
|
2009-05-27 00:03:49 +00:00
|
|
|
# include "BKE_action.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
# include "BKE_animsys.h"
|
2009-05-28 23:23:47 +00:00
|
|
|
# include "BKE_constraint.h"
|
2009-05-27 00:03:49 +00:00
|
|
|
# include "BKE_context.h"
|
|
|
|
|
|
2016-10-29 12:23:09 +02:00
|
|
|
# ifdef WITH_ALEMBIC
|
|
|
|
|
# include "ABC_alembic.h"
|
|
|
|
|
# endif
|
2009-05-27 00:03:49 +00:00
|
|
|
|
2009-09-14 16:52:06 +00:00
|
|
|
static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
|
2009-01-05 00:38:17 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
switch (con->type) {
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_CHILDOF:
|
|
|
|
|
return &RNA_ChildOfConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_TRACKTO:
|
|
|
|
|
return &RNA_TrackToConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_KINEMATIC:
|
|
|
|
|
return &RNA_KinematicConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_FOLLOWPATH:
|
|
|
|
|
return &RNA_FollowPathConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_ROTLIKE:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_CopyRotationConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCLIKE:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_CopyLocationConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_SIZELIKE:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_CopyScaleConstraint;
|
2010-03-16 12:55:56 +00:00
|
|
|
case CONSTRAINT_TYPE_SAMEVOL:
|
|
|
|
|
return &RNA_MaintainVolumeConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_PYTHON:
|
|
|
|
|
return &RNA_PythonConstraint;
|
2018-07-15 20:39:02 +03:00
|
|
|
case CONSTRAINT_TYPE_ARMATURE:
|
|
|
|
|
return &RNA_ArmatureConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_ACTION:
|
|
|
|
|
return &RNA_ActionConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_LOCKTRACK:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_LockedTrackConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_STRETCHTO:
|
|
|
|
|
return &RNA_StretchToConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_MINMAX:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_FloorConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_CLAMPTO:
|
2012-03-18 09:27:36 +00:00
|
|
|
return &RNA_ClampToConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_TRANSFORM:
|
|
|
|
|
return &RNA_TransformConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_ROTLIMIT:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_LimitRotationConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_LOCLIMIT:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_LimitLocationConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_SIZELIMIT:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_LimitScaleConstraint;
|
2009-01-20 03:55:30 +00:00
|
|
|
case CONSTRAINT_TYPE_DISTLIMIT:
|
2009-05-27 00:03:49 +00:00
|
|
|
return &RNA_LimitDistanceConstraint;
|
2009-05-30 23:31:10 +00:00
|
|
|
case CONSTRAINT_TYPE_SHRINKWRAP:
|
|
|
|
|
return &RNA_ShrinkwrapConstraint;
|
2009-10-30 06:33:40 +00:00
|
|
|
case CONSTRAINT_TYPE_DAMPTRACK:
|
|
|
|
|
return &RNA_DampedTrackConstraint;
|
2009-11-01 11:29:40 +00:00
|
|
|
case CONSTRAINT_TYPE_SPLINEIK:
|
|
|
|
|
return &RNA_SplineIKConstraint;
|
2010-01-02 04:14:17 +00:00
|
|
|
case CONSTRAINT_TYPE_TRANSLIKE:
|
|
|
|
|
return &RNA_CopyTransformsConstraint;
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
case CONSTRAINT_TYPE_PIVOT:
|
|
|
|
|
return &RNA_PivotConstraint;
|
2011-11-07 12:55:18 +00:00
|
|
|
case CONSTRAINT_TYPE_FOLLOWTRACK:
|
|
|
|
|
return &RNA_FollowTrackConstraint;
|
|
|
|
|
case CONSTRAINT_TYPE_CAMERASOLVER:
|
|
|
|
|
return &RNA_CameraSolverConstraint;
|
2011-12-05 18:57:17 +00:00
|
|
|
case CONSTRAINT_TYPE_OBJECTSOLVER:
|
|
|
|
|
return &RNA_ObjectSolverConstraint;
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
case CONSTRAINT_TYPE_TRANSFORM_CACHE:
|
|
|
|
|
return &RNA_TransformCacheConstraint;
|
2009-01-05 00:38:17 +00:00
|
|
|
default:
|
2009-01-20 03:55:30 +00:00
|
|
|
return &RNA_UnknownType;
|
2009-01-05 00:38:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2018-07-15 20:39:02 +03:00
|
|
|
{
|
|
|
|
|
bConstraintTarget *tgt = (bConstraintTarget *)ptr->data;
|
|
|
|
|
Object *ob = value.data;
|
|
|
|
|
|
|
|
|
|
if (!ob || ob->type == OB_ARMATURE) {
|
|
|
|
|
id_lib_extern((ID *)ob);
|
|
|
|
|
tgt->tar = ob;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-10-09 09:48:04 +00:00
|
|
|
static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
|
|
|
|
|
{
|
2012-03-05 23:30:41 +00:00
|
|
|
bConstraint *con = ptr->data;
|
2010-04-04 14:33:41 +00:00
|
|
|
char oldname[sizeof(con->name)];
|
2018-06-09 14:40:09 +02:00
|
|
|
|
Bugfix #19663: Renaming named data doesn't fix F-Curves
RNA Paths used in F-Curve, Drivers, etc. now get renamed when some data that they use gets renamed. This only works when things like Bones, Constraints, Shape Keys, and Modifiers get renamed, but other cases can get added easily.
The code here only performs simple string replacements, so there is the potential for problems when several sets of data with the same names are present. For example, if there are multiple armatures with bones that have the same names, renaming a bone on one armature (with a bone on another armature having the same name) will break all the drivers on the other one, even though they aren't really connected. However, I don't expect the aforementioned scenario to really be a problem in most production scenarios.
2009-10-20 03:44:35 +00:00
|
|
|
/* make a copy of the old name first */
|
2010-04-04 14:33:41 +00:00
|
|
|
BLI_strncpy(oldname, con->name, sizeof(con->name));
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-10-09 09:48:04 +00:00
|
|
|
/* copy the new name into the name slot */
|
2011-09-15 12:26:48 +00:00
|
|
|
BLI_strncpy_utf8(con->name, value, sizeof(con->name));
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-10-09 09:48:04 +00:00
|
|
|
/* make sure name is unique */
|
2019-08-23 09:52:12 +02:00
|
|
|
if (ptr->owner_id) {
|
|
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2020-06-05 18:57:12 +10:00
|
|
|
ListBase *list = ED_object_constraint_list_from_constraint(ob, con, NULL);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-10-09 09:48:04 +00:00
|
|
|
/* if we have the list, check for unique name, otherwise give up */
|
2019-06-04 00:21:57 +10:00
|
|
|
if (list) {
|
2014-04-11 11:47:07 +10:00
|
|
|
BKE_constraint_unique_name(con, list);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-10-09 09:48:04 +00:00
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
Bugfix #19663: Renaming named data doesn't fix F-Curves
RNA Paths used in F-Curve, Drivers, etc. now get renamed when some data that they use gets renamed. This only works when things like Bones, Constraints, Shape Keys, and Modifiers get renamed, but other cases can get added easily.
The code here only performs simple string replacements, so there is the potential for problems when several sets of data with the same names are present. For example, if there are multiple armatures with bones that have the same names, renaming a bone on one armature (with a bone on another armature having the same name) will break all the drivers on the other one, even though they aren't really connected. However, I don't expect the aforementioned scenario to really be a problem in most production scenarios.
2009-10-20 03:44:35 +00:00
|
|
|
/* fix all the animation data which may link to this */
|
2015-04-04 15:13:56 +11:00
|
|
|
BKE_animdata_fix_paths_rename_all(NULL, "constraints", oldname, con->name);
|
2009-10-09 09:48:04 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
static char *rna_Constraint_do_compute_path(Object *ob, bConstraint *con)
|
2009-05-27 00:03:49 +00:00
|
|
|
{
|
2009-11-26 09:48:53 +00:00
|
|
|
bPoseChannel *pchan;
|
2020-06-05 18:57:12 +10:00
|
|
|
ListBase *lb = ED_object_constraint_list_from_constraint(ob, con, &pchan);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (lb == NULL) {
|
2013-04-23 20:10:22 +00:00
|
|
|
printf("%s: internal error, constraint '%s' not found in object '%s'\n",
|
|
|
|
|
__func__,
|
|
|
|
|
con->name,
|
|
|
|
|
ob->id.name);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (pchan) {
|
2013-04-23 20:10:22 +00:00
|
|
|
char name_esc_pchan[sizeof(pchan->name) * 2];
|
|
|
|
|
char name_esc_const[sizeof(con->name) * 2];
|
2020-12-10 13:25:49 +11:00
|
|
|
BLI_str_escape(name_esc_pchan, pchan->name, sizeof(name_esc_pchan));
|
|
|
|
|
BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
|
2013-04-23 20:10:22 +00:00
|
|
|
return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", name_esc_pchan, name_esc_const);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
char name_esc_const[sizeof(con->name) * 2];
|
2020-12-10 13:25:49 +11:00
|
|
|
BLI_str_escape(name_esc_const, con->name, sizeof(name_esc_const));
|
2013-04-23 20:10:22 +00:00
|
|
|
return BLI_sprintfN("constraints[\"%s\"]", name_esc_const);
|
2009-11-26 09:48:53 +00:00
|
|
|
}
|
2009-05-27 00:03:49 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
static char *rna_Constraint_path(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2018-07-15 20:39:02 +03:00
|
|
|
bConstraint *con = ptr->data;
|
|
|
|
|
|
|
|
|
|
return rna_Constraint_do_compute_path(ob, con);
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
static bConstraint *rna_constraint_from_target(PointerRNA *ptr)
|
2018-07-15 20:39:02 +03:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2018-07-15 20:39:02 +03:00
|
|
|
bConstraintTarget *tgt = ptr->data;
|
|
|
|
|
|
2018-11-14 14:01:28 +03:00
|
|
|
return BKE_constraint_find_from_target(ob, tgt, NULL);
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static char *rna_ConstraintTarget_path(PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2018-07-15 20:39:02 +03:00
|
|
|
bConstraintTarget *tgt = ptr->data;
|
|
|
|
|
bConstraint *con = rna_constraint_from_target(ptr);
|
|
|
|
|
int index = -1;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
if (con != NULL) {
|
|
|
|
|
if (con->type == CONSTRAINT_TYPE_ARMATURE) {
|
2018-11-07 06:53:29 +11:00
|
|
|
bArmatureConstraint *acon = con->data;
|
2018-07-15 20:39:02 +03:00
|
|
|
index = BLI_findindex(&acon->targets, tgt);
|
|
|
|
|
}
|
|
|
|
|
else if (con->type == CONSTRAINT_TYPE_PYTHON) {
|
2018-11-07 06:53:29 +11:00
|
|
|
bPythonConstraint *pcon = con->data;
|
2018-07-15 20:39:02 +03:00
|
|
|
index = BLI_findindex(&pcon->targets, tgt);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
if (index >= 0) {
|
|
|
|
|
char *con_path = rna_Constraint_do_compute_path(ob, con);
|
|
|
|
|
char *result = BLI_sprintfN("%s.targets[%d]", con_path, index);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
MEM_freeN(con_path);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("%s: internal error, constraint '%s' of object '%s' does not contain the target\n",
|
|
|
|
|
__func__,
|
|
|
|
|
con->name,
|
|
|
|
|
ob->id.name);
|
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 12:27:47 +02:00
|
|
|
static void rna_Constraint_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-05-27 00:03:49 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ED_object_constraint_tag_update(bmain, (Object *)ptr->owner_id, ptr->data);
|
2009-05-27 00:03:49 +00:00
|
|
|
}
|
|
|
|
|
|
2013-02-22 00:51:58 +00:00
|
|
|
static void rna_Constraint_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
2009-05-27 00:03:49 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ED_object_constraint_dependency_tag_update(bmain, (Object *)ptr->owner_id, ptr->data);
|
2009-05-27 00:03:49 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
static void rna_ConstraintTarget_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ED_object_constraint_tag_update(bmain, (Object *)ptr->owner_id, rna_constraint_from_target(ptr));
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_ConstraintTarget_dependency_update(Main *bmain,
|
|
|
|
|
Scene *UNUSED(scene),
|
|
|
|
|
PointerRNA *ptr)
|
|
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
ED_object_constraint_dependency_tag_update(
|
|
|
|
|
bmain, (Object *)ptr->owner_id, rna_constraint_from_target(ptr));
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
2009-12-08 17:23:48 +00:00
|
|
|
static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
2009-05-27 00:03:49 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2009-05-27 00:03:49 +00:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ob->pose) {
|
2012-05-12 11:01:29 +00:00
|
|
|
ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-12-08 17:23:48 +00:00
|
|
|
rna_Constraint_update(bmain, scene, ptr);
|
2009-05-27 00:03:49 +00:00
|
|
|
}
|
|
|
|
|
|
2020-10-22 18:42:08 +11:00
|
|
|
/* Update only needed so this isn't overwritten on first evaluation. */
|
|
|
|
|
static void rna_Constraint_childof_inverse_matrix_update(Main *bmain,
|
|
|
|
|
Scene *scene,
|
|
|
|
|
PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = ptr->data;
|
|
|
|
|
bChildOfConstraint *data = con->data;
|
|
|
|
|
data->flag &= ~CHILDOF_SET_INVERSE;
|
|
|
|
|
rna_Constraint_update(bmain, scene, ptr);
|
|
|
|
|
}
|
|
|
|
|
|
2009-09-24 21:22:24 +00:00
|
|
|
static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = ptr->data;
|
|
|
|
|
bKinematicConstraint *ikdata = con->data;
|
|
|
|
|
|
|
|
|
|
if (ikdata->type != value) {
|
2012-03-05 23:30:41 +00:00
|
|
|
/* the type of IK constraint has changed, set suitable default values */
|
|
|
|
|
/* in case constraints reuse same fields incompatible */
|
2009-09-24 21:22:24 +00:00
|
|
|
switch (value) {
|
2012-05-12 11:01:29 +00:00
|
|
|
case CONSTRAINT_IK_COPYPOSE:
|
|
|
|
|
break;
|
|
|
|
|
case CONSTRAINT_IK_DISTANCE:
|
|
|
|
|
break;
|
2009-09-24 21:22:24 +00:00
|
|
|
}
|
|
|
|
|
ikdata->type = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-05-28 23:23:47 +00:00
|
|
|
|
2019-09-04 12:06:59 +03:00
|
|
|
/* DEPRECATED: use_offset replaced with mix_mode */
|
|
|
|
|
static bool rna_Constraint_RotLike_use_offset_get(struct PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = ptr->data;
|
|
|
|
|
bRotateLikeConstraint *rotlike = con->data;
|
|
|
|
|
return rotlike->mix_mode != ROTLIKE_MIX_REPLACE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_Constraint_RotLike_use_offset_set(struct PointerRNA *ptr, bool value)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = ptr->data;
|
|
|
|
|
bRotateLikeConstraint *rotlike = con->data;
|
|
|
|
|
bool curval = (rotlike->mix_mode != ROTLIKE_MIX_REPLACE);
|
|
|
|
|
if (curval != value) {
|
|
|
|
|
rotlike->mix_mode = (value ? ROTLIKE_MIX_OFFSET : ROTLIKE_MIX_REPLACE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C),
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *UNUSED(prop),
|
|
|
|
|
bool *UNUSED(r_free))
|
2009-05-28 23:23:47 +00:00
|
|
|
{
|
2019-08-23 09:52:12 +02:00
|
|
|
Object *ob = (Object *)ptr->owner_id;
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (BLI_findindex(&ob->constraints, con) == -1) {
|
2011-05-15 17:59:48 +00:00
|
|
|
return owner_space_pchan_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* object */
|
2009-05-28 23:23:47 +00:00
|
|
|
return space_object_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-05-28 23:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C),
|
|
|
|
|
PointerRNA *ptr,
|
|
|
|
|
PropertyRNA *UNUSED(prop),
|
|
|
|
|
bool *UNUSED(r_free))
|
2009-05-28 23:23:47 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2015-03-30 21:17:07 +11:00
|
|
|
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
|
2009-05-28 23:23:47 +00:00
|
|
|
ListBase targets = {NULL, NULL};
|
|
|
|
|
bConstraintTarget *ct;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (cti && cti->get_constraint_targets) {
|
2009-05-28 23:23:47 +00:00
|
|
|
cti->get_constraint_targets(con, &targets);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
for (ct = targets.first; ct; ct = ct->next) {
|
|
|
|
|
if (ct->tar && ct->tar->type == OB_ARMATURE) {
|
2009-05-28 23:23:47 +00:00
|
|
|
break;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
}
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (cti->flush_constraint_targets) {
|
2009-05-28 23:23:47 +00:00
|
|
|
cti->flush_constraint_targets(con, &targets, 1);
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-05-28 23:23:47 +00:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ct) {
|
2011-05-15 17:59:48 +00:00
|
|
|
return target_space_pchan_items;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-05-28 23:23:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return space_object_items;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
static bConstraintTarget *rna_ArmatureConstraint_target_new(ID *id, bConstraint *con, Main *bmain)
|
|
|
|
|
{
|
2018-11-07 06:53:29 +11:00
|
|
|
bArmatureConstraint *acon = con->data;
|
2018-07-15 20:39:02 +03:00
|
|
|
bConstraintTarget *tgt = MEM_callocN(sizeof(bConstraintTarget), "Constraint Target");
|
|
|
|
|
|
|
|
|
|
tgt->weight = 1.0f;
|
|
|
|
|
BLI_addtail(&acon->targets, tgt);
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
|
2018-07-15 20:39:02 +03:00
|
|
|
return tgt;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
static void rna_ArmatureConstraint_target_remove(
|
|
|
|
|
ID *id, bConstraint *con, Main *bmain, ReportList *reports, PointerRNA *target_ptr)
|
2018-07-15 20:39:02 +03:00
|
|
|
{
|
2018-11-07 06:53:29 +11:00
|
|
|
bArmatureConstraint *acon = con->data;
|
2018-07-15 20:39:02 +03:00
|
|
|
bConstraintTarget *tgt = target_ptr->data;
|
|
|
|
|
|
|
|
|
|
if (BLI_findindex(&acon->targets, tgt) < 0) {
|
2019-03-24 16:09:46 +11:00
|
|
|
BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
|
2018-07-15 20:39:02 +03:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_freelinkN(&acon->targets, tgt);
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_ArmatureConstraint_target_clear(ID *id, bConstraint *con, Main *bmain)
|
|
|
|
|
{
|
2018-11-07 06:53:29 +11:00
|
|
|
bArmatureConstraint *acon = con->data;
|
2018-07-15 20:39:02 +03:00
|
|
|
|
|
|
|
|
BLI_freelistN(&acon->targets);
|
|
|
|
|
|
2018-11-07 06:53:29 +11:00
|
|
|
ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 13:11:39 +03:00
|
|
|
static void rna_ActionConstraint_mix_mode_set(PointerRNA *ptr, int value)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
|
|
|
|
bActionConstraint *acon = (bActionConstraint *)con->data;
|
|
|
|
|
|
|
|
|
|
acon->mix_mode = value;
|
|
|
|
|
|
|
|
|
|
/* The After mode can be computed in world space for efficiency
|
|
|
|
|
* and backward compatibility, while Before requires Local. */
|
|
|
|
|
if (ELEM(value, ACTCON_MIX_AFTER, ACTCON_MIX_AFTER_FULL)) {
|
|
|
|
|
con->ownspace = CONSTRAINT_SPACE_WORLD;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
con->ownspace = CONSTRAINT_SPACE_LOCAL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-20 06:35:28 +00:00
|
|
|
static void rna_ActionConstraint_minmax_range(
|
|
|
|
|
PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
|
2009-09-21 07:25:48 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2009-09-21 07:25:48 +00:00
|
|
|
bActionConstraint *acon = (bActionConstraint *)con->data;
|
|
|
|
|
|
|
|
|
|
/* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(acon->type, 0, 1, 2)) {
|
2012-03-05 23:30:41 +00:00
|
|
|
*min = -180.0f;
|
|
|
|
|
*max = 180.0f;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2020-11-06 11:25:27 +11:00
|
|
|
*min = -1000.0f;
|
|
|
|
|
*max = 1000.0f;
|
2009-09-21 07:25:48 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-26 02:13:56 +00:00
|
|
|
static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr,
|
|
|
|
|
int length[RNA_MAX_ARRAY_DIMENSION])
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
|
2009-11-26 02:13:56 +00:00
|
|
|
|
2019-06-04 00:21:57 +10:00
|
|
|
if (ikData) {
|
2012-03-05 23:30:41 +00:00
|
|
|
length[0] = ikData->numpoints;
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-12 11:01:29 +00:00
|
|
|
length[0] = 256; /* for raw_access, untested */
|
2019-06-04 00:21:57 +10:00
|
|
|
}
|
2009-11-26 02:13:56 +00:00
|
|
|
|
|
|
|
|
return length[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-11-26 02:13:56 +00:00
|
|
|
memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
|
|
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
2012-03-05 23:30:41 +00:00
|
|
|
bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-11-26 02:13:56 +00:00
|
|
|
memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-08 13:47:26 +03:00
|
|
|
static int rna_ShrinkwrapConstraint_face_cull_get(PointerRNA *ptr)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
|
|
|
|
bShrinkwrapConstraint *swc = (bShrinkwrapConstraint *)con->data;
|
|
|
|
|
return swc->flag & CON_SHRINKWRAP_PROJECT_CULL_MASK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_ShrinkwrapConstraint_face_cull_set(struct PointerRNA *ptr, int value)
|
|
|
|
|
{
|
|
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
|
|
|
|
bShrinkwrapConstraint *swc = (bShrinkwrapConstraint *)con->data;
|
|
|
|
|
swc->flag = (swc->flag & ~CON_SHRINKWRAP_PROJECT_CULL_MASK) | value;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
|
2011-12-15 20:38:23 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)value.data;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
|
|
|
|
if (ob) {
|
2019-08-23 09:52:12 +02:00
|
|
|
if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
|
2011-12-15 20:38:23 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2011-12-15 20:38:23 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
|
|
|
|
bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data;
|
|
|
|
|
Object *ob = (Object *)value.data;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
|
|
|
|
if (ob) {
|
2019-08-23 09:52:12 +02:00
|
|
|
if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
|
2012-03-05 23:30:41 +00:00
|
|
|
data->camera = ob;
|
2015-10-16 21:50:23 +11:00
|
|
|
id_lib_extern((ID *)ob);
|
2011-12-15 20:38:23 +00:00
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
data->camera = NULL;
|
2011-12-15 20:38:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2012-01-04 17:20:08 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
|
|
|
|
bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data;
|
|
|
|
|
Object *ob = (Object *)value.data;
|
2012-01-04 17:20:08 +00:00
|
|
|
|
|
|
|
|
if (ob) {
|
2019-08-23 09:52:12 +02:00
|
|
|
if (ob->type == OB_MESH && ob != (Object *)ptr->owner_id) {
|
2012-03-05 23:30:41 +00:00
|
|
|
data->depth_ob = ob;
|
2015-10-16 21:50:23 +11:00
|
|
|
id_lib_extern((ID *)ob);
|
2012-01-04 17:20:08 +00:00
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
data->depth_ob = NULL;
|
2012-01-04 17:20:08 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
|
2012-01-04 17:20:08 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
Object *ob = (Object *)value.data;
|
2012-01-04 17:20:08 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
if (ob) {
|
2019-08-23 09:52:12 +02:00
|
|
|
if (ob->type == OB_MESH && ob != (Object *)ptr->owner_id) {
|
2012-01-04 17:20:08 +00:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-20 18:06:09 +10:00
|
|
|
static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr,
|
|
|
|
|
PointerRNA value,
|
|
|
|
|
struct ReportList *UNUSED(reports))
|
2011-12-15 20:38:23 +00:00
|
|
|
{
|
2012-05-12 11:01:29 +00:00
|
|
|
bConstraint *con = (bConstraint *)ptr->data;
|
|
|
|
|
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
|
|
|
|
|
Object *ob = (Object *)value.data;
|
2011-12-15 20:38:23 +00:00
|
|
|
|
|
|
|
|
if (ob) {
|
2019-08-23 09:52:12 +02:00
|
|
|
if (ob->type == OB_CAMERA && ob != (Object *)ptr->owner_id) {
|
2012-03-05 23:30:41 +00:00
|
|
|
data->camera = ob;
|
2015-10-16 21:50:23 +11:00
|
|
|
id_lib_extern((ID *)ob);
|
2011-12-15 20:38:23 +00:00
|
|
|
}
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-03-05 23:30:41 +00:00
|
|
|
data->camera = NULL;
|
2011-12-15 20:38:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
#else
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem constraint_distance_items[] = {
|
2012-03-18 09:27:36 +00:00
|
|
|
{LIMITDIST_INSIDE,
|
|
|
|
|
"LIMITDIST_INSIDE",
|
|
|
|
|
0,
|
|
|
|
|
"Inside",
|
|
|
|
|
"The object is constrained inside a virtual sphere around the target object, "
|
|
|
|
|
"with a radius defined by the limit distance"},
|
|
|
|
|
{LIMITDIST_OUTSIDE,
|
|
|
|
|
"LIMITDIST_OUTSIDE",
|
|
|
|
|
0,
|
|
|
|
|
"Outside",
|
|
|
|
|
"The object is constrained outside a virtual sphere around the target object, "
|
|
|
|
|
"with a radius defined by the limit distance"},
|
|
|
|
|
{LIMITDIST_ONSURFACE,
|
|
|
|
|
"LIMITDIST_ONSURFACE",
|
|
|
|
|
0,
|
|
|
|
|
"On Surface",
|
|
|
|
|
"The object is constrained on the surface of a virtual sphere around the target object, "
|
|
|
|
|
"with a radius defined by the limit distance"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2009-10-09 09:48:04 +00:00
|
|
|
};
|
|
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
static void rna_def_constraint_headtail_common(StructRNA *srna)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop;
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
|
2020-12-13 12:59:36 -08:00
|
|
|
RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head is 0, Tail is 1");
|
2016-05-18 03:19:06 +12:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
prop = RNA_def_property(srna, "use_bbone_shape", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, "bConstraint", "flag", CONSTRAINT_BBONE_SHAPE);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Follow B-Bone",
|
|
|
|
|
"Follow shape of B-Bone segments when calculating Head/Tail position");
|
2018-08-09 17:17:40 +03:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2016-05-18 03:19:06 +12:00
|
|
|
}
|
|
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
static void rna_def_constraint_target_common(StructRNA *srna)
|
2009-01-20 03:55:30 +00:00
|
|
|
{
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
2018-05-03 15:00:12 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Target", "Target object");
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "subtarget");
|
2018-05-03 16:00:34 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2018-05-03 15:00:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constrainttarget(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2018-07-15 20:39:02 +03:00
|
|
|
PropertyRNA *prop;
|
2018-05-03 15:00:12 +02:00
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "ConstraintTarget", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
|
2018-07-15 20:39:02 +03:00
|
|
|
RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
|
2018-05-03 15:00:12 +02:00
|
|
|
RNA_def_struct_sdna(srna, "bConstraintTarget");
|
|
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Target", "Target object");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_update(
|
|
|
|
|
prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "subtarget");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
|
|
|
|
|
RNA_def_property_update(
|
|
|
|
|
prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
/* space, flag and type still to do */
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
static void rna_def_constrainttarget_bone(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
srna = RNA_def_struct(brna, "ConstraintTargetBone", NULL);
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Constraint Target Bone", "Target bone for multi-target constraints");
|
|
|
|
|
RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
|
|
|
|
|
RNA_def_struct_sdna(srna, "bConstraintTarget");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Target", "Target armature");
|
|
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, NULL, "rna_ConstraintTargetBone_target_set", NULL, "rna_Armature_object_poll");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_update(
|
|
|
|
|
prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "subtarget");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
|
|
|
|
|
RNA_def_property_update(
|
|
|
|
|
prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-20 10:15:27 +11:00
|
|
|
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
|
2018-07-15 20:39:02 +03:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "weight");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
static void rna_def_constraint_childof(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_CHILDOF);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2018-06-09 14:40:09 +02:00
|
|
|
|
Constraints: replace 'Set Inverse' operator with an eval-time update
This fixes {T70269}.
Before this commit there was complicated code to try and compute the
correct parent inverse matrix for the 'Child Of' and 'Object Solver'
constraints outside the constraint evaluation. This was done mostly
correctly, but did have some issues. The Set Inverse operator now defers
this computation to be performed during constraint evaluation by just
setting a flag. If the constraint is disabled, and thus tagging it for
update in the depsgraph is not enough to trigger immediate evaluation,
evaluation is forced by temporarily enabling it.
This fix changes the way how the inverse matrix works when some of the
channels of the constraint are disabled. Before this commit, the channel
flags were used to filter both the parent and the inverse matrix. This
meant that it was impossible to make an inverse matrix that would
actually fully neutralize the effect of the constraint. Now only the
parent matrix is filtered, while inverse is applied fully. As a result,
pressing the 'Set Inverse' matrix produces the same transformation as
disabling the constraint. This is also reflected in the changed values
in the 'Child Of' unit test.
This change is not backward compatible, but it should be OK because the
old way was effectively unusable, so it is unlikely anybody relied on
it.
The change in matrix for the Object Solver constraint is due to a
different method of computing it, which caused a slightly different
floating point error that was slightly bigger than allowed by the test,
so I updated the matrix values there as well.
This patch was original written by @angavrilov and subsequently updated
by me.
Differential Revision: https://developer.blender.org/D6091
2020-02-27 10:24:11 +01:00
|
|
|
prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SET_INVERSE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
|
2011-07-13 17:20:20 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "invmat");
|
|
|
|
|
RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
|
2020-10-22 18:42:08 +11:00
|
|
|
RNA_def_property_update(
|
|
|
|
|
prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_childof_inverse_matrix_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_python(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "PythonConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
|
|
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ConstraintTarget");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Targets", "Target Objects");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "tarnum");
|
2020-12-11 07:35:44 -08:00
|
|
|
RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1 to 3 are needed");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Targets", "Use the targets indicated in the constraint panel");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
|
2009-03-23 13:24:48 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
static void rna_def_constraint_armature_deform_targets(BlenderRNA *brna, PropertyRNA *cprop)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
PropertyRNA *parm;
|
|
|
|
|
|
|
|
|
|
RNA_def_property_srna(cprop, "ArmatureConstraintTargets");
|
|
|
|
|
srna = RNA_def_struct(brna, "ArmatureConstraintTargets", NULL);
|
|
|
|
|
RNA_def_struct_sdna(srna, "bConstraint");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Armature Deform Constraint Targets", "Collection of target bones and weights");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
|
2018-07-15 20:39:02 +03:00
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_ArmatureConstraint_target_new");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
|
|
|
|
RNA_def_function_ui_description(func, "Add a new target to the constraint");
|
|
|
|
|
parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "New target bone");
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "remove", "rna_ArmatureConstraint_target_remove");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
|
|
|
|
|
RNA_def_function_ui_description(func, "Delete target from the constraint");
|
|
|
|
|
parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "Target to remove");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
|
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "clear", "rna_ArmatureConstraint_target_clear");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
|
|
|
|
|
RNA_def_function_ui_description(func, "Delete all targets from object");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_armature_deform(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
srna = RNA_def_struct(brna, "ArmatureConstraint", "Constraint");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Armature Constraint", "Applies transformations done by the Armature modifier");
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bArmatureConstraint", "data");
|
2019-08-08 13:58:53 -06:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_ARMATURE);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ConstraintTargetBone");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Targets", "Target Bones");
|
|
|
|
|
rna_def_constraint_armature_deform_targets(brna, prop);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_QUATERNION);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_ENVELOPE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Use Envelopes",
|
|
|
|
|
"Multiply weights by envelope for all bones, instead of acting like Vertex Group based "
|
|
|
|
|
"blending. "
|
|
|
|
|
"The specified weights are still used, and only the listed bones are considered");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 20:39:02 +03:00
|
|
|
prop = RNA_def_property(srna, "use_current_location", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_CUR_LOCATION);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Use Current Location",
|
|
|
|
|
"Use the current bone location for envelopes and choosing B-Bone "
|
|
|
|
|
"segments instead of rest position");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2018-07-15 20:39:02 +03:00
|
|
|
}
|
|
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
static void rna_def_constraint_kinematic(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem constraint_ik_axisref_items[] = {
|
2011-04-03 23:11:00 +00:00
|
|
|
{0, "BONE", 0, "Bone", ""},
|
|
|
|
|
{CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem constraint_ik_type_items[] = {
|
2011-04-03 23:11:00 +00:00
|
|
|
{CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
|
|
|
|
|
{CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_KINEMATIC);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
|
2012-11-24 00:18:34 +00:00
|
|
|
RNA_def_property_range(prop, 0, 10000);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "poletar");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "polesubtarget");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "poleangle");
|
2010-01-25 06:24:05 +00:00
|
|
|
RNA_def_property_range(prop, -M_PI, M_PI);
|
2014-06-06 09:50:38 +10:00
|
|
|
RNA_def_property_ui_range(prop, -M_PI, M_PI, 10, 4);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, 0.01, 1.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Weight", "For Tree-IK: Weight of position control for this target");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "orientweight");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, 0.01, 1.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "rootbone");
|
|
|
|
|
RNA_def_property_range(prop, 0, 255);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_POS);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_X);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Y);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Z);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
|
2020-07-02 16:28:45 -04:00
|
|
|
RNA_def_property_ui_text(prop, "Lock X Rotation", "Constraint rotation along X axis");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
|
2020-07-02 16:28:45 -04:00
|
|
|
RNA_def_property_ui_text(prop, "Lock Y Rotation", "Constraint rotation along Y axis");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
|
2009-10-14 18:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
|
2020-07-02 16:28:45 -04:00
|
|
|
RNA_def_property_ui_text(prop, "Lock Z Rotation", "Constraint rotation along Z axis");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
|
2009-09-24 21:22:24 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
|
|
|
|
|
RNA_def_property_enum_items(prop, constraint_ik_type_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "IK Type", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
|
2009-09-24 21:22:24 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, constraint_distance_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
|
2009-09-24 21:22:24 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "dist");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, 0.0, 100.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_track_to(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem up_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{TRACK_X, "UP_X", 0, "X", ""},
|
|
|
|
|
{TRACK_Y, "UP_Y", 0, "Y", ""},
|
|
|
|
|
{TRACK_Z, "UP_Z", 0, "Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Track To Constraint", "Aim the constrained object toward the target");
|
2009-11-28 03:45:40 +00:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2009-11-28 03:45:40 +00:00
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
|
|
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
|
|
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "reserved1");
|
2018-10-03 19:09:43 +03:00
|
|
|
RNA_def_property_enum_items(prop, track_axis_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "reserved2");
|
|
|
|
|
RNA_def_property_enum_items(prop, up_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
2010-01-02 04:14:17 +00:00
|
|
|
static void rna_def_constraint_locate_like(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIKE);
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2010-01-02 04:14:17 +00:00
|
|
|
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
|
|
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-01-02 04:14:17 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2010-01-02 04:14:17 +00:00
|
|
|
}
|
|
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
static void rna_def_constraint_rotate_like(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2019-09-04 12:06:59 +03:00
|
|
|
static const EnumPropertyItem mix_mode_items[] = {
|
|
|
|
|
{ROTLIKE_MIX_REPLACE, "REPLACE", 0, "Replace", "Replace the original rotation with copied"},
|
|
|
|
|
{ROTLIKE_MIX_ADD, "ADD", 0, "Add", "Add euler component values together"},
|
|
|
|
|
{ROTLIKE_MIX_BEFORE,
|
|
|
|
|
"BEFORE",
|
|
|
|
|
0,
|
|
|
|
|
"Before Original",
|
|
|
|
|
"Apply copied rotation before original, as if the constraint target is a parent"},
|
|
|
|
|
{ROTLIKE_MIX_AFTER,
|
|
|
|
|
"AFTER",
|
|
|
|
|
0,
|
|
|
|
|
"After Original",
|
|
|
|
|
"Apply copied rotation after original, as if the constraint target is a child"},
|
|
|
|
|
{ROTLIKE_MIX_OFFSET,
|
|
|
|
|
"OFFSET",
|
|
|
|
|
0,
|
|
|
|
|
"Offset (Legacy)",
|
|
|
|
|
"Combine rotations like the original Offset checkbox. Does not work well for "
|
|
|
|
|
"multiple axis rotations"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIKE);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
|
2009-05-27 00:03:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2019-09-01 13:19:11 +03:00
|
|
|
prop = RNA_def_property(srna, "euler_order", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "euler_order");
|
|
|
|
|
RNA_def_property_enum_items(prop, euler_order_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Euler Order", "Explicitly specify the euler rotation order");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2019-09-04 12:06:59 +03:00
|
|
|
prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mix_mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, mix_mode_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mix Mode", "Specify how the copied and existing rotations are combined");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
|
|
|
|
/* DEPRECATED: replaced with mix_mode */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
|
2019-09-04 12:06:59 +03:00
|
|
|
RNA_def_property_boolean_funcs(
|
|
|
|
|
prop, "rna_Constraint_RotLike_use_offset_get", "rna_Constraint_RotLike_use_offset_set");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Offset", "DEPRECATED: Add original rotation into copied rotation");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
2010-01-02 04:14:17 +00:00
|
|
|
static void rna_def_constraint_size_like(BlenderRNA *brna)
|
2009-01-20 03:55:30 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIKE);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2019-05-08 12:08:54 +03:00
|
|
|
prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "power");
|
|
|
|
|
RNA_def_property_float_default(prop, 1.0f);
|
|
|
|
|
RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Power", "Raise the target's scale to the specified power");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2019-08-28 16:56:27 +03:00
|
|
|
prop = RNA_def_property(srna, "use_make_uniform", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_UNIFORM);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Make Uniform",
|
|
|
|
|
"Redistribute the copied change in volume equally "
|
|
|
|
|
"between the three axes of the owner");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
|
2010-01-02 04:14:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
|
2018-07-24 18:53:22 +03:00
|
|
|
RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIZELIKE_MULTIPLY);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Additive",
|
|
|
|
|
"Use addition instead of multiplication to combine scale (2.7 compatibility)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2010-01-02 04:14:17 +00:00
|
|
|
}
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2010-03-16 12:55:56 +00:00
|
|
|
static void rna_def_constraint_same_volume(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 21:47:51 +03:00
|
|
|
static const EnumPropertyItem axis_items[] = {
|
2012-03-18 09:27:36 +00:00
|
|
|
{SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
|
|
|
|
|
{SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
|
2010-03-16 12:55:56 +00:00
|
|
|
{SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2010-03-16 12:55:56 +00:00
|
|
|
};
|
|
|
|
|
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 21:47:51 +03:00
|
|
|
static const EnumPropertyItem mode_items[] = {
|
|
|
|
|
{SAMEVOL_STRICT,
|
|
|
|
|
"STRICT",
|
|
|
|
|
0,
|
|
|
|
|
"Strict",
|
|
|
|
|
"Volume is strictly preserved, overriding the scaling of non-free axes"},
|
|
|
|
|
{SAMEVOL_UNIFORM,
|
|
|
|
|
"UNIFORM",
|
|
|
|
|
0,
|
|
|
|
|
"Uniform",
|
|
|
|
|
"Volume is preserved when the object is scaled uniformly. "
|
|
|
|
|
"Deviations from uniform scale on non-free axes are passed through"},
|
|
|
|
|
{SAMEVOL_SINGLE_AXIS,
|
|
|
|
|
"SINGLE_AXIS",
|
|
|
|
|
0,
|
|
|
|
|
"Single Axis",
|
|
|
|
|
"Volume is preserved when the object is scaled only on the free axis. "
|
|
|
|
|
"Non-free axis scaling is passed through"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
|
|
|
|
|
RNA_def_struct_ui_text(srna,
|
2010-02-10 21:15:44 +00:00
|
|
|
"Maintain Volume Constraint",
|
2012-05-12 11:01:29 +00:00
|
|
|
"Maintain a constant volume along a single scaling axis");
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_SAMEVOL);
|
2010-03-16 12:55:56 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 21:47:51 +03:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "free_axis");
|
|
|
|
|
RNA_def_property_enum_items(prop, axis_items);
|
2010-03-16 12:55:56 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2010-03-16 12:55:56 +00:00
|
|
|
|
Maintain Volume: introduce an option switching between modes.
After a lot of thinking about this, I decided that all operation modes
that I've tried over the past couple of years, including the original
2.79 one, have their uses after all. Thus the only reasonable solution
is to add yet another option.
The modes are:
- Strict: The current 2.80 mode, which overrides the original scaling
of the non-free axes to strictly preserve the volume. This is the most
obvious way one would expect a 'Maintain Volume' constraint to work.
- Uniform: The original 2.79 mode, which assumes that all axes have been
scaled the same as the free one when computing the volume. This seems
strange, but the net effect is that when simply scaling the object
uniformly with S, the volume is preserved; however, scaling the non-
free axes individually allows deviating from the locked volume.
This was obviously intended as a more or less convenient UI tool.
- Single Axis: My own variant of the intent of the Uniform scale, which
does volume-preserving if the object is scaled just on the Free axis,
while passing the non-free axis scaling through. I.e. instead of
uniform S scaling, the user has to scale the object just on its
primary axis to achieve constant volume. This can allow reducing the
number of animation curves when only constant volume scaling is needed,
or be an easier to control tool inside a complex rig.
2019-05-06 21:47:51 +03:00
|
|
|
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, mode_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mode", "The way the constraint treats original non-free axis scaling");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_range(prop, 0.001f, 100.0f);
|
2015-01-13 18:06:53 +13:00
|
|
|
RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2010-03-16 12:55:56 +00:00
|
|
|
}
|
|
|
|
|
|
2010-01-02 04:14:17 +00:00
|
|
|
static void rna_def_constraint_transform_like(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
2019-09-04 14:59:18 +03:00
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem mix_mode_items[] = {
|
|
|
|
|
{TRANSLIKE_MIX_REPLACE,
|
|
|
|
|
"REPLACE",
|
|
|
|
|
0,
|
|
|
|
|
"Replace",
|
|
|
|
|
"Replace the original transformation with copied"},
|
|
|
|
|
{TRANSLIKE_MIX_BEFORE,
|
|
|
|
|
"BEFORE",
|
|
|
|
|
0,
|
|
|
|
|
"Before Original",
|
|
|
|
|
"Apply copied transformation before original, as if the constraint target is a parent. "
|
|
|
|
|
"Scale is handled specially to avoid creating shear"},
|
|
|
|
|
{TRANSLIKE_MIX_AFTER,
|
|
|
|
|
"AFTER",
|
|
|
|
|
0,
|
|
|
|
|
"After Original",
|
|
|
|
|
"Apply copied transformation after original, as if the constraint target is a child. "
|
|
|
|
|
"Scale is handled specially to avoid creating shear"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2011-01-02 04:16:19 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
|
|
|
|
|
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_TRANSLIKE);
|
|
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2019-09-04 14:59:18 +03:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2019-09-04 14:59:18 +03:00
|
|
|
prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mix_mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, mix_mode_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Mix Mode", "Specify how the copied and existing transformations are combined");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_minmax(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem minmax_items[] = {
|
2011-01-01 15:28:21 +00:00
|
|
|
{TRACK_X, "FLOOR_X", 0, "X", ""},
|
|
|
|
|
{TRACK_Y, "FLOOR_Y", 0, "Y", ""},
|
|
|
|
|
{TRACK_Z, "FLOOR_Z", 0, "Z", ""},
|
|
|
|
|
{TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
|
|
|
|
|
{TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
|
|
|
|
|
{TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Floor Constraint", "Use the target object for location limitation");
|
2012-04-29 15:47:02 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_FLOOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "minmaxflag");
|
|
|
|
|
RNA_def_property_enum_items(prop, minmax_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Floor Location", "Location of target that object will not pass through");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
|
2013-09-02 22:24:44 +00:00
|
|
|
RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, -1);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_action(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem transform_channel_items[] = {
|
2012-01-27 01:30:58 +00:00
|
|
|
{20, "LOCATION_X", 0, "X Location", ""},
|
|
|
|
|
{21, "LOCATION_Y", 0, "Y Location", ""},
|
|
|
|
|
{22, "LOCATION_Z", 0, "Z Location", ""},
|
|
|
|
|
{00, "ROTATION_X", 0, "X Rotation", ""},
|
|
|
|
|
{01, "ROTATION_Y", 0, "Y Rotation", ""},
|
|
|
|
|
{02, "ROTATION_Z", 0, "Z Rotation", ""},
|
2012-01-31 04:23:49 +00:00
|
|
|
{10, "SCALE_X", 0, "X Scale", ""},
|
2012-01-27 01:30:58 +00:00
|
|
|
{11, "SCALE_Y", 0, "Y Scale", ""},
|
|
|
|
|
{12, "SCALE_Z", 0, "Z Scale", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 13:11:39 +03:00
|
|
|
static const EnumPropertyItem mix_mode_items[] = {
|
|
|
|
|
{ACTCON_MIX_BEFORE,
|
|
|
|
|
"BEFORE",
|
|
|
|
|
0,
|
|
|
|
|
"Before Original",
|
|
|
|
|
"Apply the action channels before the original transformation, "
|
|
|
|
|
"as if applied to an imaginary parent with Aligned Inherit Scale"},
|
|
|
|
|
{ACTCON_MIX_AFTER,
|
|
|
|
|
"AFTER",
|
|
|
|
|
0,
|
|
|
|
|
"After Original",
|
|
|
|
|
"Apply the action channels after the original transformation, "
|
|
|
|
|
"as if applied to an imaginary child with Aligned Inherit Scale"},
|
|
|
|
|
{ACTCON_MIX_AFTER_FULL,
|
|
|
|
|
"AFTER_FULL",
|
|
|
|
|
0,
|
|
|
|
|
"After Original (Full Scale)",
|
|
|
|
|
"Apply the action channels after the original transformation, as if "
|
|
|
|
|
"applied to an imaginary child with Full Inherit Scale. This mode "
|
|
|
|
|
"can create shear and is provided only for backward compatibility"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Action Constraint", "Map an action to the transform axes of a bone");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_ACTION);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
Action Constraint: introduce a mix mode setting.
Currently the action channels are applied after the existing
transformation, as if the action controlled a child of the
bone. This is not very natural, but more importantly, the
transform tools are not designed to work conveniently with an
additional 'pseudo-child' transformation, resulting in effects
like an unexpected pivot location.
Implementing a Before mode that integrates the action channels
as if applied to a parent allows using the special transform
tool code intended for dealing with such constraints.
Note that in either mode, Action constraints should be added
in reverse order, putting a new constraint before the existing
ones that the Action was keyframed to work together.
In order to implement the option, extract a utility from
the Copy Transform constraint code for combining transforms
with special anti-shear scale handling that matches the
Aligned Inherit Scale mode.
The Before mode also requires switching the constraint to
the Local owner space, while the After mode can still use the
World space for efficiency as before. Since the constraint
doesn't have an Owner space option in the UI, this has to be
handled in an RNA setter.
For full backward compatibility, the original simple matrix
multiplication mode is preserved as the third option, but it
is not recommended due to creating shear.
Differential Revision: https://developer.blender.org/D6297
2019-11-23 13:11:39 +03:00
|
|
|
prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mix_mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, mix_mode_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, "rna_ActionConstraint_mix_mode_set", NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Mix Mode",
|
|
|
|
|
"Specify how existing transformations and the action channels are combined");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
|
|
|
|
RNA_def_property_enum_items(prop, transform_channel_items);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Transform Channel",
|
|
|
|
|
"Transformation channel from the target that is used to key the Action");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "act");
|
2012-05-17 10:28:30 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
|
2011-05-15 17:59:48 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Action", "The constraining action");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-12 06:22:23 +00:00
|
|
|
prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
|
2012-06-12 11:54:31 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACTCON_BONE_USE_OBJECT_ACTION);
|
2012-06-12 06:22:23 +00:00
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Object Action",
|
|
|
|
|
"Bones only: apply the object's transformation channels of the action "
|
|
|
|
|
"to the constrained bone, instead of bone's channels");
|
2012-06-27 18:29:47 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "start");
|
2009-07-07 06:56:29 +00:00
|
|
|
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "end");
|
2009-07-07 06:56:29 +00:00
|
|
|
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "max");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0f, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-09-21 07:25:48 +00:00
|
|
|
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "min");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0f, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-09-21 07:25:48 +00:00
|
|
|
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
2020-09-16 15:52:43 +02:00
|
|
|
prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "eval_time");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
2020-09-16 15:52:43 +02:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Evaluation Time", "Interpolates between Action Start and End frames");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "use_eval_time", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", ACTCON_USE_EVAL_TIME);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Use Evaluation Time",
|
|
|
|
|
"Interpolate between Action Start and End frames, with the Evaluation "
|
|
|
|
|
"Time slider instead of the Target object/bone");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_locked_track(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem lock_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{TRACK_X, "LOCK_X", 0, "X", ""},
|
|
|
|
|
{TRACK_Y, "LOCK_Y", 0, "Y", ""},
|
|
|
|
|
{TRACK_Z, "LOCK_Z", 0, "Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna,
|
|
|
|
|
"Locked Track Constraint",
|
|
|
|
|
"Point toward the target along the track axis, while locking the other axis");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_LOCKTRACK);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
|
|
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
|
2018-10-03 19:09:43 +03:00
|
|
|
RNA_def_property_enum_items(prop, track_axis_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "lockflag");
|
|
|
|
|
RNA_def_property_enum_items(prop, lock_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_follow_path(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem forwardpath_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{TRACK_X, "FORWARD_X", 0, "X", ""},
|
|
|
|
|
{TRACK_Y, "FORWARD_Y", 0, "Y", ""},
|
|
|
|
|
{TRACK_Z, "FORWARD_Z", 0, "Z", ""},
|
|
|
|
|
{TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
|
|
|
|
|
{TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
|
|
|
|
|
{TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem pathup_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{TRACK_X, "UP_X", 0, "X", ""},
|
|
|
|
|
{TRACK_Y, "UP_Y", 0, "Y", ""},
|
|
|
|
|
{TRACK_Z, "UP_Z", 0, "Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWPATH);
|
2019-06-05 14:30:44 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
2010-08-03 06:51:36 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
|
2018-05-03 15:00:12 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Target", "Target Curve object");
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
|
2009-09-08 09:41:15 +00:00
|
|
|
RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Offset", "Offset from the position corresponding to the time frame");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
|
2010-02-03 09:05:31 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "offset_fac");
|
2009-09-08 09:41:15 +00:00
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
2012-10-05 13:06:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Offset Factor", "Percentage value defining target position along length of curve");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
|
|
|
|
|
RNA_def_property_enum_items(prop, forwardpath_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "upflag");
|
|
|
|
|
RNA_def_property_enum_items(prop, pathup_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
|
2009-09-08 09:41:15 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Follow Curve", "Object will follow the heading and banking of the curve");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
|
2009-09-08 09:41:15 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Fixed Position",
|
|
|
|
|
"Object will stay locked to a single point somewhere along the length of the curve "
|
|
|
|
|
"regardless of time");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
|
2009-09-12 16:25:49 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_stretch_to(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem volume_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
|
2011-03-04 06:34:41 +00:00
|
|
|
{VOLUME_X, "VOLUME_X", 0, "X", ""},
|
2009-06-16 00:52:21 +00:00
|
|
|
{VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
|
|
|
|
|
{NO_VOLUME, "NO_VOLUME", 0, "None", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem plane_items[] = {
|
2019-11-06 17:11:32 +03:00
|
|
|
{PLANE_X, "PLANE_X", 0, "XZ", "Rotate around local X, then Z"},
|
|
|
|
|
{PLANE_Z, "PLANE_Z", 0, "ZX", "Rotate around local Z, then X"},
|
|
|
|
|
{SWING_Y,
|
|
|
|
|
"SWING_Y",
|
|
|
|
|
0,
|
|
|
|
|
"Swing",
|
|
|
|
|
"Use the smallest single axis rotation, similar to Damped Track"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_STRETCHTO);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "volmode");
|
|
|
|
|
RNA_def_property_enum_items(prop, volume_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Maintain Volume", "Maintain the object's volume as it stretches");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "plane");
|
|
|
|
|
RNA_def_property_enum_items(prop, plane_items);
|
2019-11-06 17:11:32 +03:00
|
|
|
RNA_def_property_ui_text(prop, "Keep Axis", "The rotation type and axis order to use");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "orglength");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
2015-04-17 01:07:05 +12:00
|
|
|
RNA_def_property_ui_range(prop, 0, 100.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, 0.0, 100.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Volume Variation", "Factor between volume variation and stretching");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-13 19:51:46 +02:00
|
|
|
prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", STRETCHTOCON_USE_BULGE_MIN);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-13 19:51:46 +02:00
|
|
|
prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", STRETCHTOCON_USE_BULGE_MAX);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-13 19:51:46 +02:00
|
|
|
prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
|
2014-10-14 11:49:58 +02:00
|
|
|
RNA_def_property_range(prop, 0.0, 1.0f);
|
2014-10-13 19:51:46 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-13 19:51:46 +02:00
|
|
|
prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
|
2014-10-14 11:49:58 +02:00
|
|
|
RNA_def_property_range(prop, 1.0, 100.0f);
|
2014-10-13 19:51:46 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-10-13 19:51:46 +02:00
|
|
|
prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0f);
|
2015-01-13 18:06:53 +13:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
|
2014-10-13 19:51:46 +02:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_clamp_to(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem clamp_items[] = {
|
2009-06-16 00:52:21 +00:00
|
|
|
{CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
|
|
|
|
|
{CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
|
|
|
|
|
{CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
|
|
|
|
|
{CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna,
|
|
|
|
|
"Clamp To Constraint",
|
2012-04-14 15:44:31 +00:00
|
|
|
"Constrain an object's location to the nearest point along the target path");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_CLAMPTO);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
2011-07-08 12:48:43 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
2010-08-03 06:51:36 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
|
2013-01-05 12:27:54 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)");
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, clamp_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_transform(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem transform_items[] = {
|
2020-07-02 16:28:45 -04:00
|
|
|
{TRANS_LOCATION, "LOCATION", 0, "Location", ""},
|
|
|
|
|
{TRANS_ROTATION, "ROTATION", 0, "Rotation", ""},
|
2014-04-07 12:10:37 +02:00
|
|
|
{TRANS_SCALE, "SCALE", 0, "Scale", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-06 11:54:34 +03:00
|
|
|
static const EnumPropertyItem mix_mode_loc_items[] = {
|
|
|
|
|
{TRANS_MIXLOC_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
|
|
|
|
|
{TRANS_MIXLOC_ADD, "ADD", 0, "Add", "Add component values together"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem mix_mode_rot_items[] = {
|
|
|
|
|
{TRANS_MIXROT_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
|
|
|
|
|
{TRANS_MIXROT_ADD, "ADD", 0, "Add", "Add component values together"},
|
|
|
|
|
{TRANS_MIXROT_BEFORE,
|
|
|
|
|
"BEFORE",
|
|
|
|
|
0,
|
|
|
|
|
"Before Original",
|
|
|
|
|
"Apply new rotation before original, as if it was on a parent"},
|
|
|
|
|
{TRANS_MIXROT_AFTER,
|
|
|
|
|
"AFTER",
|
|
|
|
|
0,
|
|
|
|
|
"After Original",
|
|
|
|
|
"Apply new rotation after original, as if it was on a child"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const EnumPropertyItem mix_mode_scale_items[] = {
|
|
|
|
|
{TRANS_MIXSCALE_REPLACE, "REPLACE", 0, "Replace", "Replace component values"},
|
|
|
|
|
{TRANS_MIXSCALE_MULTIPLY, "MULTIPLY", 0, "Multiply", "Multiply component values together"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
|
2012-04-14 15:44:31 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Transformation Constraint", "Map transformations of the target to the object");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "from");
|
|
|
|
|
RNA_def_property_enum_items(prop, transform_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "to");
|
|
|
|
|
RNA_def_property_enum_items(prop, transform_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Map To", "The transformation type to affect of the constrained object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "map[0]");
|
2016-01-07 20:22:49 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Map To X From", "The source axis constrained object's X axis uses");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "map[1]");
|
2016-01-07 20:22:49 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Map To Y From", "The source axis constrained object's Y axis uses");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "map[2]");
|
2016-01-07 20:22:49 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Map To Z From", "The source axis constrained object's Z axis uses");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-01 13:19:11 +03:00
|
|
|
prop = RNA_def_property(srna, "from_rotation_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "from_rotation_mode");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_driver_target_rotation_mode_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Mode", "Specify the type of rotation channels to use");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "to_euler_order", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "to_euler_order");
|
|
|
|
|
RNA_def_property_enum_items(prop, euler_order_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Order", "Explicitly specify the output euler rotation order");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
/* Loc */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
|
2009-11-23 16:53:29 +00:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-06 11:54:34 +03:00
|
|
|
prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mix_mode_loc");
|
|
|
|
|
RNA_def_property_enum_items(prop, mix_mode_loc_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Location Mix Mode", "Specify how to combine the new location with original");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
/* Rot */
|
|
|
|
|
prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min_rot[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min_rot[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min_rot[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max_rot[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max_rot[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max_rot[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min_rot[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min_rot[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min_rot[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max_rot[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max_rot[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max_rot[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-09-06 11:54:34 +03:00
|
|
|
prop = RNA_def_property(srna, "mix_mode_rot", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mix_mode_rot");
|
|
|
|
|
RNA_def_property_enum_items(prop, mix_mode_rot_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Rotation Mix Mode", "Specify how to combine the new rotation with original");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
/* Scale */
|
|
|
|
|
prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min_scale[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min_scale[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_min_scale[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max_scale[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max_scale[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "from_max_scale[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min_scale[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min_scale[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_min_scale[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max_scale[0]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max_scale[1]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-07 12:10:37 +02:00
|
|
|
prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
|
2014-04-28 13:20:37 +02:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "to_max_scale[2]");
|
2014-04-07 12:10:37 +02:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-09-06 11:54:34 +03:00
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "mix_mode_scale", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mix_mode_scale");
|
|
|
|
|
RNA_def_property_enum_items(prop, mix_mode_scale_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Scale Mix Mode", "Specify how to combine the new scale with original");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_location_limit(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Limit Location Constraint", "Limit the location of the constrained object");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_LOCLIMIT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "xmin");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ymin");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "zmin");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "xmax");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ymax");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "zmax");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
2020-11-22 13:33:27 +03:00
|
|
|
prop, "Affect Transform", "Transform tools are affected by this constraint as well");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_ROTLIMIT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
|
2009-05-30 23:31:10 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_limit_y", PROP_BOOLEAN, PROP_NONE);
|
2009-05-30 23:31:10 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YROT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_limit_z", PROP_BOOLEAN, PROP_NONE);
|
2009-05-30 23:31:10 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZROT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "xmin");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ymin");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "zmin");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "xmax");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ymax");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "zmax");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
2020-11-22 13:33:27 +03:00
|
|
|
prop, "Affect Transform", "Transform tools are affected by this constraint as well");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_size_limit(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_SIZELIMIT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "xmin");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ymin");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "zmin");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "xmax");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "ymax");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "zmax");
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, -1000.0, 1000.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
2020-11-22 13:33:27 +03:00
|
|
|
prop, "Affect Transform", "Transform tools are affected by this constraint as well");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_distance_limit(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Limit Distance Constraint", "Limit the distance from target object");
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_DISTLIMIT);
|
2019-06-05 14:30:44 +02:00
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "dist");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2009-01-20 03:55:30 +00:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "mode");
|
2009-09-24 21:22:24 +00:00
|
|
|
RNA_def_property_enum_items(prop, constraint_distance_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
|
2011-05-24 12:12:12 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMITDIST_TRANSFORM);
|
|
|
|
|
RNA_def_property_ui_text(
|
2020-06-19 12:40:48 -04:00
|
|
|
prop, "Affect Transform", "Transforms are affected by this constraint as well");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-01-20 03:55:30 +00:00
|
|
|
}
|
|
|
|
|
|
2009-05-30 23:31:10 +00:00
|
|
|
static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem type_items[] = {
|
2012-03-18 09:27:36 +00:00
|
|
|
{MOD_SHRINKWRAP_NEAREST_SURFACE,
|
|
|
|
|
"NEAREST_SURFACE",
|
|
|
|
|
0,
|
|
|
|
|
"Nearest Surface Point",
|
|
|
|
|
"Shrink the location to the nearest target surface"},
|
|
|
|
|
{MOD_SHRINKWRAP_PROJECT,
|
|
|
|
|
"PROJECT",
|
|
|
|
|
0,
|
|
|
|
|
"Project",
|
|
|
|
|
"Shrink the location to the nearest target surface along a given axis"},
|
|
|
|
|
{MOD_SHRINKWRAP_NEAREST_VERTEX,
|
|
|
|
|
"NEAREST_VERTEX",
|
|
|
|
|
0,
|
|
|
|
|
"Nearest Vertex",
|
|
|
|
|
"Shrink the location to the nearest target vertex"},
|
Shrinkwrap: new mode that projects along the target normal.
The Nearest Surface Point shrink method, while fast, is neither
smooth nor continuous: as the source point moves, the projected
point can both stop and jump. This causes distortions in the
deformation of the shrinkwrap modifier, and the motion of an
animated object with a shrinkwrap constraint.
This patch implements a new mode, which, instead of using the simple
nearest point search, iteratively solves an equation for each triangle
to find a point which has its interpolated normal point to or from the
original vertex. Non-manifold boundary edges are treated as infinitely
thin cylinders that cast normals in all perpendicular directions.
Since this is useful for the constraint, and having multiple
objects with constraints targeting the same guide mesh is a quite
reasonable use case, rather than calculating the mesh boundary edge
data over and over again, it is precomputed and cached in the mesh.
Reviewers: mont29
Differential Revision: https://developer.blender.org/D3836
2018-11-06 21:04:53 +03:00
|
|
|
{MOD_SHRINKWRAP_TARGET_PROJECT,
|
|
|
|
|
"TARGET_PROJECT",
|
|
|
|
|
0,
|
|
|
|
|
"Target Normal Project",
|
|
|
|
|
"Shrink the location to the nearest target surface "
|
|
|
|
|
"along the interpolated vertex normals of the target"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 13:47:26 +03:00
|
|
|
static const EnumPropertyItem shrink_face_cull_items[] = {
|
|
|
|
|
{0, "OFF", 0, "Off", "No culling"},
|
|
|
|
|
{CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE,
|
|
|
|
|
"FRONT",
|
|
|
|
|
0,
|
|
|
|
|
"Front",
|
|
|
|
|
"No projection when in front of the face"},
|
|
|
|
|
{CON_SHRINKWRAP_PROJECT_CULL_BACKFACE,
|
|
|
|
|
"BACK",
|
|
|
|
|
0,
|
|
|
|
|
"Back",
|
2019-02-03 14:01:45 +11:00
|
|
|
"No projection when behind the face"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
2018-07-08 13:47:26 +03:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
|
2009-05-31 12:47:36 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_SHRINKWRAP);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
2010-08-03 06:51:36 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "target"); /* TODO, mesh type */
|
|
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
|
2018-05-03 15:00:12 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Target", "Target Mesh object");
|
2009-05-30 23:31:10 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
|
2009-05-30 23:31:10 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
|
|
|
|
|
RNA_def_property_enum_items(prop, type_items);
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
|
2018-10-03 19:09:43 +03:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-07 18:39:45 +03:00
|
|
|
prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "shrinkMode");
|
|
|
|
|
RNA_def_property_enum_items(prop, rna_enum_modifier_shrinkwrap_mode_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Snap Mode", "Select how to constrain the object to the target surface");
|
2018-10-03 19:09:43 +03:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
|
2009-05-30 23:31:10 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "dist");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-09-07 12:59:16 +00:00
|
|
|
prop = RNA_def_property(srna, "project_axis", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "projAxis");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
|
2013-09-07 12:59:16 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Project Axis", "Axis constrain to");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-09-07 12:59:16 +00:00
|
|
|
prop = RNA_def_property(srna, "project_axis_space", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "projAxisSpace");
|
|
|
|
|
RNA_def_property_enum_items(prop, owner_space_pchan_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Axis Space", "Space for the projection axis");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-09-07 12:59:16 +00:00
|
|
|
prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_DISTANCE);
|
|
|
|
|
RNA_def_property_float_sdna(prop, NULL, "projLimit");
|
2015-11-24 20:29:33 +01:00
|
|
|
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
|
|
|
|
RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
|
2013-09-07 12:59:16 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Project Distance", "Limit the distance used for projection (zero disables)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 13:47:26 +03:00
|
|
|
prop = RNA_def_property(srna, "use_project_opposite", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_PROJECT_OPPOSITE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Project Opposite", "Project in both specified and opposite directions");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 13:47:26 +03:00
|
|
|
prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "flag");
|
|
|
|
|
RNA_def_property_enum_items(prop, shrink_face_cull_items);
|
|
|
|
|
RNA_def_property_enum_funcs(prop,
|
|
|
|
|
"rna_ShrinkwrapConstraint_face_cull_get",
|
|
|
|
|
"rna_ShrinkwrapConstraint_face_cull_set",
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Face Cull",
|
|
|
|
|
"Stop vertices from projecting to a face on the target when facing towards/away");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-08 13:47:26 +03:00
|
|
|
prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_PROJECT_INVERT_CULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Invert Cull", "When projecting in the opposite direction invert the face cull mode");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-10-03 19:09:43 +03:00
|
|
|
prop = RNA_def_property(srna, "use_track_normal", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_TRACK_NORMAL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Align Axis To Normal", "Align the specified axis to the surface normal");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-10-03 19:09:43 +03:00
|
|
|
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "trackAxis");
|
|
|
|
|
RNA_def_property_enum_items(prop, track_axis_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Track Axis", "Axis that is aligned to the normal");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-05-30 23:31:10 +00:00
|
|
|
}
|
|
|
|
|
|
2009-10-30 06:33:40 +00:00
|
|
|
static void rna_def_constraint_damped_track(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_TRACKTO);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2018-06-09 14:40:09 +02:00
|
|
|
|
2009-10-30 06:33:40 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
|
|
|
|
|
|
2018-05-03 15:00:12 +02:00
|
|
|
rna_def_constraint_target_common(srna);
|
2009-10-30 06:33:40 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
|
2009-10-30 06:33:40 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
|
2018-10-03 19:09:43 +03:00
|
|
|
RNA_def_property_enum_items(prop, track_axis_items);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-10-30 06:33:40 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-01 11:29:40 +00:00
|
|
|
static void rna_def_constraint_spline_ik(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem splineik_xz_scale_mode[] = {
|
2009-11-23 00:03:51 +00:00
|
|
|
{CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPLINEIK_XZS_ORIGINAL,
|
|
|
|
|
"BONE_ORIGINAL",
|
|
|
|
|
0,
|
|
|
|
|
"Bone Original",
|
|
|
|
|
"Use the original scaling of the bones"},
|
2015-01-13 18:06:53 +13:00
|
|
|
{CONSTRAINT_SPLINEIK_XZS_INVERSE,
|
|
|
|
|
"INVERSE_PRESERVE",
|
|
|
|
|
0,
|
|
|
|
|
"Inverse Scale",
|
|
|
|
|
"Scale of the X and Z axes is the inverse of the Y-Scale"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC,
|
|
|
|
|
"VOLUME_PRESERVE",
|
|
|
|
|
0,
|
|
|
|
|
"Volume Preservation",
|
2015-01-13 18:06:53 +13:00
|
|
|
"Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-15 20:25:41 +03:00
|
|
|
static const EnumPropertyItem splineik_y_scale_mode[] = {
|
|
|
|
|
{CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"},
|
|
|
|
|
{CONSTRAINT_SPLINEIK_YS_FIT_CURVE,
|
|
|
|
|
"FIT_CURVE",
|
|
|
|
|
0,
|
|
|
|
|
"Fit Curve",
|
|
|
|
|
"Scale the bones to fit the entire length of the curve"},
|
|
|
|
|
{CONSTRAINT_SPLINEIK_YS_ORIGINAL,
|
|
|
|
|
"BONE_ORIGINAL",
|
|
|
|
|
0,
|
|
|
|
|
"Bone Original",
|
|
|
|
|
"Use the original Y scale of the bone"},
|
|
|
|
|
{0, NULL, 0, NULL, NULL},
|
|
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
|
2009-11-01 11:29:40 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_SPLINEIK);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2009-11-02 10:04:37 +00:00
|
|
|
/* target chain */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
2009-11-02 10:04:37 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
2015-02-19 10:02:51 +11:00
|
|
|
RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
|
2009-11-02 10:04:37 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
|
2009-11-01 11:29:40 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
|
2009-11-01 11:29:40 +00:00
|
|
|
RNA_def_property_int_sdna(prop, NULL, "chainlen");
|
2012-05-12 11:01:29 +00:00
|
|
|
/* TODO: this should really check the max length of the chain the constraint is attached to */
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_range(prop, 1, 255);
|
2009-11-01 11:29:40 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
|
2012-05-12 11:01:29 +00:00
|
|
|
/* XXX: this update goes wrong... needs extra flush? */
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-16 12:33:42 +00:00
|
|
|
/* direct access to bindings */
|
2012-03-05 23:30:41 +00:00
|
|
|
/* NOTE: only to be used by experienced users */
|
|
|
|
|
prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
|
2009-11-26 02:13:56 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_DYNAMIC);
|
|
|
|
|
RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_float_funcs(prop,
|
|
|
|
|
"rna_SplineIKConstraint_joint_bindings_get",
|
|
|
|
|
"rna_SplineIKConstraint_joint_bindings_set",
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Joint Bindings",
|
|
|
|
|
"(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
|
|
|
|
|
"as percentages");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-02 10:04:37 +00:00
|
|
|
/* settings */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
|
2009-11-12 12:20:57 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Chain Offset", "Offset the entire chain relative to the root joint");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
|
2009-11-02 10:04:37 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Even Divisions",
|
|
|
|
|
"Ignore the relative lengths of the bones when fitting to the curve");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
|
2009-11-23 00:03:51 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Use Curve Radius",
|
|
|
|
|
"Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
|
|
|
|
|
"on top of XZ Scale mode");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
/* xz scaling mode */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
|
2009-11-05 10:09:45 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
|
|
|
|
|
RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"XZ Scale Mode",
|
|
|
|
|
"Method used for determining the scaling of the X and Z axes of the bones");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-15 20:25:41 +03:00
|
|
|
/* y scaling mode */
|
|
|
|
|
prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "yScaleMode");
|
|
|
|
|
RNA_def_property_enum_items(prop, splineik_y_scale_mode);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Y Scale Mode",
|
|
|
|
|
"Method used for determining the scaling of the Y axis of the bones, "
|
|
|
|
|
"on top of the shape and scaling of the curve itself");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-07 19:52:10 +03:00
|
|
|
/* take original scaling of the bone into account in volume preservation */
|
|
|
|
|
prop = RNA_def_property(srna, "use_original_scale", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_ORIGINAL_SCALE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Original Scale", "Apply volume preservation over the original scaling");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
/* volume presevation for "volumetric" scale mode */
|
|
|
|
|
prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
|
2020-11-06 11:25:27 +11:00
|
|
|
RNA_def_property_range(prop, 0.0, 100.0f);
|
2015-01-13 18:06:53 +13:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Volume Variation", "Factor between volume variation and stretching");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_BULGE_MIN);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_BULGE_MAX);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
|
|
|
|
|
RNA_def_property_range(prop, 1.0, 100.0f);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-01-13 18:06:53 +13:00
|
|
|
prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
|
|
|
|
|
RNA_def_property_range(prop, 0.0, 1.0f);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2009-11-01 11:29:40 +00:00
|
|
|
}
|
|
|
|
|
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
static void rna_def_constraint_pivot(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem pivot_rotAxis_items[] = {
|
2011-05-15 17:59:48 +00:00
|
|
|
{PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
|
2012-03-18 09:27:36 +00:00
|
|
|
{PIVOTCON_AXIS_X_NEG,
|
|
|
|
|
"NX",
|
|
|
|
|
0,
|
2020-07-02 16:28:45 -04:00
|
|
|
"-X Rotation",
|
2012-03-18 09:27:36 +00:00
|
|
|
"Use the pivot point in the negative rotation range around the X-axis"},
|
|
|
|
|
{PIVOTCON_AXIS_Y_NEG,
|
|
|
|
|
"NY",
|
|
|
|
|
0,
|
2020-07-02 16:28:45 -04:00
|
|
|
"-Y Rotation",
|
2012-03-18 09:27:36 +00:00
|
|
|
"Use the pivot point in the negative rotation range around the Y-axis"},
|
|
|
|
|
{PIVOTCON_AXIS_Z_NEG,
|
|
|
|
|
"NZ",
|
|
|
|
|
0,
|
2020-07-02 16:28:45 -04:00
|
|
|
"-Z Rotation",
|
2012-03-18 09:27:36 +00:00
|
|
|
"Use the pivot point in the negative rotation range around the Z-axis"},
|
2011-05-15 17:59:48 +00:00
|
|
|
{PIVOTCON_AXIS_X,
|
|
|
|
|
"X",
|
|
|
|
|
0,
|
2020-07-02 16:28:45 -04:00
|
|
|
"X Rotation",
|
2011-05-15 17:59:48 +00:00
|
|
|
"Use the pivot point in the positive rotation range around the X-axis"},
|
|
|
|
|
{PIVOTCON_AXIS_Y,
|
|
|
|
|
"Y",
|
|
|
|
|
0,
|
2020-07-02 16:28:45 -04:00
|
|
|
"Y Rotation",
|
2011-05-15 17:59:48 +00:00
|
|
|
"Use the pivot point in the positive rotation range around the Y-axis"},
|
|
|
|
|
{PIVOTCON_AXIS_Z,
|
|
|
|
|
"Z",
|
|
|
|
|
0,
|
2020-07-02 16:28:45 -04:00
|
|
|
"Z Rotation",
|
2011-05-15 17:59:48 +00:00
|
|
|
"Use the pivot point in the positive rotation range around the Z-axis"},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-05-12 11:01:29 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-05-18 03:19:06 +12:00
|
|
|
rna_def_constraint_headtail_common(srna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_PIVOT);
|
|
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
/* target-defined pivot */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "tar");
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Target", "Target Object, defining the position of the pivot when defined");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "subtarget");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Sub-Target", "");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
/* pivot offset */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Use Relative Offset",
|
|
|
|
|
"Offset will be an absolute point in space instead of relative to the target");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-20 21:50:27 +01:00
|
|
|
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "offset");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Offset",
|
|
|
|
|
"Offset of pivot from target (when set), or from owner's location "
|
|
|
|
|
"(when Fixed Position is off), or the absolute pivot point");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
/* rotation-based activation */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "rotAxis");
|
|
|
|
|
RNA_def_property_enum_items(prop, pivot_rotAxis_items);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
}
|
|
|
|
|
|
2011-11-07 12:55:18 +00:00
|
|
|
static void rna_def_constraint_follow_track(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-08-09 16:57:02 +00:00
|
|
|
static const EnumPropertyItem frame_method_items[] = {
|
|
|
|
|
{FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
|
|
|
|
|
{FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
|
|
|
|
|
{FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-08-09 16:57:02 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
|
2011-11-19 12:21:15 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Follow Track Constraint", "Lock motion to the target motion track");
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_FOLLOWTRACK);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2011-11-07 12:55:18 +00:00
|
|
|
/* movie clip */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "clip");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-07 12:55:18 +00:00
|
|
|
/* track */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "track");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-07 12:55:18 +00:00
|
|
|
/* use default clip */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-14 06:41:42 +00:00
|
|
|
/* use 3d position */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
|
2011-11-14 06:41:42 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-05 18:57:17 +00:00
|
|
|
/* object */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
|
2011-12-05 18:57:17 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "object");
|
2011-12-15 20:38:23 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-15 20:38:23 +00:00
|
|
|
/* camera */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
|
2011-12-15 20:38:23 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "camera");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
|
2011-12-15 20:38:23 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Constraint_followTrack_camera_set",
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Constraint_cameraObject_poll");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-01-04 17:20:08 +00:00
|
|
|
/* depth object */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
|
2012-01-04 17:20:08 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "depth_ob");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Depth Object",
|
|
|
|
|
"Object used to define depth in camera space by projecting onto surface of this object");
|
2012-01-04 17:20:08 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Constraint_followTrack_depthObject_set",
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Constraint_followTrack_depthObject_poll");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-08-09 16:57:02 +00:00
|
|
|
/* frame method */
|
|
|
|
|
prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_enum_bitflag_sdna(prop, NULL, "frame_method");
|
|
|
|
|
RNA_def_property_enum_items(prop, frame_method_items);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Frame Method", "How the footage fits in the camera frame");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-07-24 21:00:35 +06:00
|
|
|
/* use undistortion */
|
|
|
|
|
prop = RNA_def_property(srna, "use_undistorted_position", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_UNDISTORTION);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Undistort", "Parent to undistorted position of 2D track");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rna_def_constraint_camera_solver(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
|
2011-12-05 18:57:17 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_CAMERASOLVER);
|
2011-11-07 12:55:18 +00:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2011-11-07 12:55:18 +00:00
|
|
|
/* movie clip */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "clip");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2011-11-07 12:55:18 +00:00
|
|
|
|
|
|
|
|
/* use default clip */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
|
2011-11-07 12:55:18 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
|
|
|
|
|
2011-12-05 18:57:17 +00:00
|
|
|
static void rna_def_constraint_object_solver(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
|
2011-12-05 18:57:17 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_OBJECTSOLVER);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2011-12-05 18:57:17 +00:00
|
|
|
/* movie clip */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
2011-12-05 18:57:17 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "clip");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-05 18:57:17 +00:00
|
|
|
/* use default clip */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
|
2011-12-05 18:57:17 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
Constraints: replace 'Set Inverse' operator with an eval-time update
This fixes {T70269}.
Before this commit there was complicated code to try and compute the
correct parent inverse matrix for the 'Child Of' and 'Object Solver'
constraints outside the constraint evaluation. This was done mostly
correctly, but did have some issues. The Set Inverse operator now defers
this computation to be performed during constraint evaluation by just
setting a flag. If the constraint is disabled, and thus tagging it for
update in the depsgraph is not enough to trigger immediate evaluation,
evaluation is forced by temporarily enabling it.
This fix changes the way how the inverse matrix works when some of the
channels of the constraint are disabled. Before this commit, the channel
flags were used to filter both the parent and the inverse matrix. This
meant that it was impossible to make an inverse matrix that would
actually fully neutralize the effect of the constraint. Now only the
parent matrix is filtered, while inverse is applied fully. As a result,
pressing the 'Set Inverse' matrix produces the same transformation as
disabling the constraint. This is also reflected in the changed values
in the 'Child Of' unit test.
This change is not backward compatible, but it should be OK because the
old way was effectively unusable, so it is unlikely anybody relied on
it.
The change in matrix for the Object Solver constraint is due to a
different method of computing it, which caused a slightly different
floating point error that was slightly bigger than allowed by the test,
so I updated the matrix values there as well.
This patch was original written by @angavrilov and subsequently updated
by me.
Differential Revision: https://developer.blender.org/D6091
2020-02-27 10:24:11 +01:00
|
|
|
prop = RNA_def_property(srna, "set_inverse_pending", PROP_BOOLEAN, PROP_NONE);
|
|
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", OBJECTSOLVER_SET_INVERSE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Set Inverse Pending", "Set to true to request recalculation of the inverse matrix");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
|
|
|
|
|
2011-12-05 18:57:17 +00:00
|
|
|
/* object */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
|
2011-12-05 18:57:17 +00:00
|
|
|
RNA_def_property_string_sdna(prop, NULL, "object");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-15 20:38:23 +00:00
|
|
|
/* camera */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
|
2011-12-15 20:38:23 +00:00
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "camera");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
|
2011-12-15 20:38:23 +00:00
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Constraint_objectSolver_camera_set",
|
|
|
|
|
NULL,
|
|
|
|
|
"rna_Constraint_cameraObject_poll");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
2011-12-05 18:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
static void rna_def_constraint_transform_cache(BlenderRNA *brna)
|
|
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "TransformCacheConstraint", "Constraint");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Transform Cache Constraint", "Look up transformation from an external file");
|
|
|
|
|
RNA_def_struct_sdna_from(srna, "bTransformCacheConstraint", "data");
|
2019-06-04 18:10:47 +02:00
|
|
|
RNA_def_struct_ui_icon(srna, ICON_CON_TRANSFORM_CACHE);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "cache_file");
|
|
|
|
|
RNA_def_property_struct_type(prop, "CacheFile");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Cache File", "");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Object Path",
|
|
|
|
|
"Path to the object in the Alembic archive used to lookup the transform matrix");
|
2019-04-04 15:07:37 +02:00
|
|
|
RNA_def_property_update(prop, 0, "rna_Constraint_update");
|
2020-06-03 18:45:24 +02:00
|
|
|
|
|
|
|
|
RNA_define_lib_overridable(false);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
}
|
|
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
/* base struct for constraints */
|
2009-01-20 03:55:30 +00:00
|
|
|
void RNA_def_constraint(BlenderRNA *brna)
|
2008-12-12 23:30:23 +00:00
|
|
|
{
|
|
|
|
|
StructRNA *srna;
|
|
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
/* data */
|
2012-05-12 11:01:29 +00:00
|
|
|
srna = RNA_def_struct(brna, "Constraint", NULL);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Constraint", "Constraint modifying the transformation of objects and bones");
|
2009-01-20 03:55:30 +00:00
|
|
|
RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
|
2009-05-27 00:03:49 +00:00
|
|
|
RNA_def_struct_path_func(srna, "rna_Constraint_path");
|
2008-12-12 23:30:23 +00:00
|
|
|
RNA_def_struct_sdna(srna, "bConstraint");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
/* strings */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
|
2009-10-09 09:48:04 +00:00
|
|
|
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set");
|
2010-05-09 08:33:18 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Name", "Constraint name");
|
2008-12-12 23:30:23 +00:00
|
|
|
RNA_def_struct_name_property(srna, prop);
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT | NA_RENAME, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
/* enums */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
|
2009-03-23 13:24:48 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-12-12 23:30:23 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "type");
|
2015-11-23 13:49:52 +11:00
|
|
|
RNA_def_property_enum_items(prop, rna_enum_constraint_type_items);
|
2008-12-12 23:30:23 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Type", "");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(true);
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "ownspace");
|
2011-05-15 17:59:48 +00:00
|
|
|
RNA_def_property_enum_items(prop, owner_space_pchan_items);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
|
2019-03-20 14:19:30 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_sdna(prop, NULL, "tarspace");
|
2011-05-15 17:59:48 +00:00
|
|
|
RNA_def_property_enum_items(prop, target_space_pchan_items);
|
2009-05-28 23:23:47 +00:00
|
|
|
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
|
2019-03-20 14:19:30 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-03 10:42:29 +01:00
|
|
|
prop = RNA_def_property(srna, "space_object", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_pointer_sdna(prop, NULL, "space_object");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Object", "Object for Custom Space");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
|
|
|
|
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "space_subtarget", PROP_STRING, PROP_NONE);
|
|
|
|
|
RNA_def_property_string_sdna(prop, NULL, "space_subtarget");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
|
|
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
|
|
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
/* flags */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
|
2010-09-06 07:26:21 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
|
2019-03-20 14:19:30 +01:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
2019-08-08 13:58:53 -06:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
|
2019-04-01 10:22:06 +02:00
|
|
|
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
|
2020-06-19 12:40:48 -04:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "ui_expand_flag", 0);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
|
2018-11-22 15:31:19 +11:00
|
|
|
RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 02:48:05 +10:00
|
|
|
/* XXX this is really an internal flag,
|
|
|
|
|
* but it may be useful for some tools to be able to access this... */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
|
2009-03-23 13:24:48 +00:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2010-08-21 04:51:00 +00:00
|
|
|
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE);
|
2011-04-23 11:13:36 +00:00
|
|
|
RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-05-12 11:01:29 +00:00
|
|
|
/* TODO: setting this to true must ensure that all others in stack are turned off too... */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
|
2008-12-12 23:30:23 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
|
2019-04-02 17:42:30 +02:00
|
|
|
RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
|
2019-04-02 17:43:33 +02:00
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2008-12-12 23:30:23 +00:00
|
|
|
RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Proxy Local",
|
|
|
|
|
"Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-27 05:04:23 +00:00
|
|
|
/* values */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
|
2009-01-27 05:04:23 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "enforce");
|
|
|
|
|
RNA_def_property_range(prop, 0.0f, 1.0f);
|
2010-02-10 21:15:44 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop, "Influence", "Amount of influence constraint will have on the final solution");
|
2012-05-12 11:01:29 +00:00
|
|
|
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_influence_update");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-09-24 21:22:24 +00:00
|
|
|
/* readonly values */
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
|
2009-09-24 21:22:24 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "lin_error");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
|
|
|
|
"Lin error",
|
|
|
|
|
"Amount of residual error in Blender space unit for constraints that work on position");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
|
2009-09-24 21:22:24 +00:00
|
|
|
RNA_def_property_float_sdna(prop, NULL, "rot_error");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
2012-03-18 09:27:36 +00:00
|
|
|
RNA_def_property_ui_text(
|
|
|
|
|
prop,
|
2020-11-04 12:08:04 -07:00
|
|
|
"Rotation error",
|
2012-10-27 13:22:44 +00:00
|
|
|
"Amount of residual error in radians for constraints that work on orientation");
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-03 18:45:24 +02:00
|
|
|
RNA_define_lib_overridable(false);
|
|
|
|
|
|
2008-12-12 23:30:23 +00:00
|
|
|
/* pointers */
|
2009-01-20 03:55:30 +00:00
|
|
|
rna_def_constrainttarget(brna);
|
2018-07-15 20:39:02 +03:00
|
|
|
rna_def_constrainttarget_bone(brna);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-01-20 03:55:30 +00:00
|
|
|
rna_def_constraint_childof(brna);
|
|
|
|
|
rna_def_constraint_python(brna);
|
2018-07-15 20:39:02 +03:00
|
|
|
rna_def_constraint_armature_deform(brna);
|
2009-01-20 03:55:30 +00:00
|
|
|
rna_def_constraint_stretch_to(brna);
|
|
|
|
|
rna_def_constraint_follow_path(brna);
|
|
|
|
|
rna_def_constraint_locked_track(brna);
|
|
|
|
|
rna_def_constraint_action(brna);
|
|
|
|
|
rna_def_constraint_size_like(brna);
|
2010-03-16 12:55:56 +00:00
|
|
|
rna_def_constraint_same_volume(brna);
|
2009-01-20 03:55:30 +00:00
|
|
|
rna_def_constraint_locate_like(brna);
|
|
|
|
|
rna_def_constraint_rotate_like(brna);
|
2010-01-02 04:14:17 +00:00
|
|
|
rna_def_constraint_transform_like(brna);
|
2009-01-20 03:55:30 +00:00
|
|
|
rna_def_constraint_minmax(brna);
|
|
|
|
|
rna_def_constraint_track_to(brna);
|
|
|
|
|
rna_def_constraint_kinematic(brna);
|
|
|
|
|
rna_def_constraint_clamp_to(brna);
|
|
|
|
|
rna_def_constraint_distance_limit(brna);
|
|
|
|
|
rna_def_constraint_size_limit(brna);
|
|
|
|
|
rna_def_constraint_rotation_limit(brna);
|
|
|
|
|
rna_def_constraint_location_limit(brna);
|
|
|
|
|
rna_def_constraint_transform(brna);
|
2009-05-30 23:31:10 +00:00
|
|
|
rna_def_constraint_shrinkwrap(brna);
|
2009-10-30 06:33:40 +00:00
|
|
|
rna_def_constraint_damped_track(brna);
|
2009-11-01 11:29:40 +00:00
|
|
|
rna_def_constraint_spline_ik(brna);
|
== Pivot Constraint ==
This constraint allows an object or bone to have their rotations applied as if their origin/pivot-point was located elsewhere. The most obvious uses include foot-roll, see-saws, but could also include more complicated rolling-box examples.
== Usage Examples ==
=== Foot Roll ===
1. Add 'Pivot' Constraint to the bone without any target.
2. Set the 'Y' value of the offset to the length of the bone. Usually this should be negative (if you rig with feet facing 'forwards' along -Y axis). This gives you a pivot point relative to the bone's (preconstraint) location, which should be at the tip of the bone here. Disabling the 'Use Relative Offset' would make this offset be relative to 0,0,0 instead of to the owner/bone-head.
3. Ensure that the 'Pivot When' setting is set to '-X Rot', (default) which means that the pivot will only used when the rotation on the X-Axis is negative to get tip-toe 'roll'.
=== See Saw ===
1. Add a 'Pivot' constraint too see-saw plank object, this time with a target that you wish to have as the pivot-point. It's possible to do this without too (as before), but is less intuitive.
2. Optionally, if you want the plank slightly raised, set the z-offset value, which should make the pivot-point used to be relative to the target with the z-offset applied.
3. Ensure that 'Pivot When' is set to 'Always', which means that the pivot will always be used, irrespective of the rotation.
== Notes ==
* The 'Pivot When' setting has been integrated in the constraint, since this is something that will often be required for these setups. Having to set up additional drivers to drive the constraint to do this kindof beats the purpose of providing this.
* The 'Offset' functionality is probably not presented as clearly as it could be. We may need to go over this again.
* For foot-roll - if any scaling of the foot is required, simply set up a driver on the y-offset to make this dynamically respond to the "scale" RNA property of the bones (don't use the "Transform Channel" vartype since that won't work correct here). However, this shouldn't be common enough to warrant special treatment.
2010-05-27 10:50:06 +00:00
|
|
|
rna_def_constraint_pivot(brna);
|
2011-11-07 12:55:18 +00:00
|
|
|
rna_def_constraint_follow_track(brna);
|
|
|
|
|
rna_def_constraint_camera_solver(brna);
|
2011-12-05 18:57:17 +00:00
|
|
|
rna_def_constraint_object_solver(brna);
|
Basic Alembic support
All in all, this patch adds an Alembic importer, an Alembic exporter,
and a new CacheFile data block which, for now, wraps around an Alembic
archive. This data block is made available through a new modifier ("Mesh
Sequence Cache") as well as a new constraint ("Transform Cache") to
somewhat properly support respectively geometric and transformation data
streaming from alembic caches.
A more in-depth documentation is to be found on the wiki, as well as a
guide to compile alembic: https://wiki.blender.org/index.php/
User:Kevindietrich/AlembicBasicIo.
Many thanks to everyone involved in this little project, and huge shout
out to "cgstrive" for the thorough testings with Maya, 3ds Max, Houdini
and Realflow as well as @fjuhec, @jensverwiebe and @jasperge for the
custom builds and compile fixes.
Reviewers: sergey, campbellbarton, mont29
Reviewed By: sergey, campbellbarton, mont29
Differential Revision: https://developer.blender.org/D2060
2016-08-06 06:20:37 +02:00
|
|
|
rna_def_constraint_transform_cache(brna);
|
2008-12-12 23:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
2009-06-02 23:53:40 +00:00
|
|
|
#endif
|