Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2007-04-06 23:42:46 +0400
committerMartin Poirier <theeth@yahoo.com>2007-04-06 23:42:46 +0400
commitf42bc12285388e6fb93cba1223f90dcb7dcf5373 (patch)
treefb1d14d458489245de698bf09c86544294f57123 /source
parent3f07ca5954c3343f88b418cb56c4c57f0c20b285 (diff)
=== BPY ===
Adding Python counterparts to the Invert params for Copy Rot and Copy Loc. I had to align the constants being used, so if you had files using those options (introduced after 2.43), you'll have to modify the INVERT settings for ROTLIKE constraints (didn't feel like making a minor version bump for this, if people thing otherwise, please say so). Based on a patch by Juho Vepsäläinen (bebraw)
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h15
-rw-r--r--source/blender/python/api2_2x/Constraint.c12
-rw-r--r--source/blender/python/api2_2x/doc/Constraint.py2
3 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 14506f1b1aa..6cf1403b803 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -252,14 +252,19 @@ typedef struct bRigidBodyJointConstraint{
#define CONSTRAINT_CHANNEL_SELECT 0x01
#define CONSTRAINT_CHANNEL_PROTECTED 0x02
+/**
+ * The flags for ROTLIKE, LOCLIKE and SIZELIKE should be kept identical
+ * (that is, same effect, different name). It simplifies the Python API access a lot.
+ */
+
/* bRotateLikeConstraint.flag */
#define ROTLIKE_X 0x01
#define ROTLIKE_Y 0x02
#define ROTLIKE_Z 0x04
-#define ROTLIKE_X_INVERT 0x08
-#define ROTLIKE_Y_INVERT 0x10
-#define ROTLIKE_Z_INVERT 0x20
-#define ROTLIKE_OFFSET 0x40
+#define ROTLIKE_X_INVERT 0x10
+#define ROTLIKE_Y_INVERT 0x20
+#define ROTLIKE_Z_INVERT 0x40
+#define ROTLIKE_OFFSET 0x80
/* bLocateLikeConstraint.flag */
#define LOCLIKE_X 0x01
@@ -275,7 +280,7 @@ typedef struct bRigidBodyJointConstraint{
#define SIZELIKE_X 0x01
#define SIZELIKE_Y 0x02
#define SIZELIKE_Z 0x04
-#define SIZELIKE_OFFSET 0x08
+#define SIZELIKE_OFFSET 0x80
/* Axis flags */
#define LOCK_X 0x00
diff --git a/source/blender/python/api2_2x/Constraint.c b/source/blender/python/api2_2x/Constraint.c
index 1fb202be6af..602ef7a396b 100644
--- a/source/blender/python/api2_2x/Constraint.c
+++ b/source/blender/python/api2_2x/Constraint.c
@@ -876,7 +876,7 @@ static int locatelike_setter( BPy_Constraint *self, int type, PyObject *value )
}
case EXPP_CONSTR_COPY:
return EXPP_setIValueRange( value, &con->flag,
- 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z, 'i' );
+ 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z | LOCLIKE_X_INVERT | LOCLIKE_Y_INVERT | LOCLIKE_Z_INVERT, 'i' );
case EXPP_CONSTR_LOCAL:
if( !get_armature( con->tar ) )
return EXPP_ReturnIntError( PyExc_RuntimeError,
@@ -934,7 +934,7 @@ static int rotatelike_setter( BPy_Constraint *self, int type, PyObject *value )
}
case EXPP_CONSTR_COPY:
return EXPP_setIValueRange( value, &con->flag,
- 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z, 'i' );
+ 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z | LOCLIKE_X_INVERT | LOCLIKE_Y_INVERT | LOCLIKE_Z_INVERT, 'i' );
case EXPP_CONSTR_LOCAL:
if( !get_armature( con->tar ) )
return EXPP_ReturnIntError( PyExc_RuntimeError,
@@ -994,7 +994,7 @@ static int sizelike_setter( BPy_Constraint *self, int type, PyObject *value )
}
case EXPP_CONSTR_COPY:
return EXPP_setIValueRange( value, &con->flag,
- 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z, 'i' );
+ 0, LOCLIKE_X | LOCLIKE_Y | LOCLIKE_Z | LOCLIKE_X_INVERT | LOCLIKE_Y_INVERT | LOCLIKE_Z_INVERT, 'i' );
#if 0
case EXPP_CONSTR_LOCAL:
if( !get_armature( con->tar ) )
@@ -1957,6 +1957,12 @@ static PyObject *M_Constraint_SettingsDict( void )
PyInt_FromLong( LOCLIKE_Y ) );
PyConstant_Insert( d, "COPYZ",
PyInt_FromLong( LOCLIKE_Z ) );
+ PyConstant_Insert( d, "COPYXINVERT",
+ PyInt_FromLong( LOCLIKE_X_INVERT ) );
+ PyConstant_Insert( d, "COPYYINVERT",
+ PyInt_FromLong( LOCLIKE_Y_INVERT ) );
+ PyConstant_Insert( d, "COPYZINVERT",
+ PyInt_FromLong( LOCLIKE_Z_INVERT ) );
PyConstant_Insert( d, "TARGET",
PyInt_FromLong( EXPP_CONSTR_TARGET ) );
diff --git a/source/blender/python/api2_2x/doc/Constraint.py b/source/blender/python/api2_2x/doc/Constraint.py
index da69fb23c06..627db9050e3 100644
--- a/source/blender/python/api2_2x/doc/Constraint.py
+++ b/source/blender/python/api2_2x/doc/Constraint.py
@@ -82,7 +82,7 @@ Or to print all the constraints attached to each bone in a pose::
- OFFSET (float): clamped to [-100.0,100.0]
- STICKY (bool)
- Used by Copy Location (COPYLOC) and Copy Rotation (COPYROT)
- - COPY (bitfield): any combination of COPYX, COPYY and COPYZ
+ - COPY (bitfield): any combination of COPYX, COPYY and COPYZ with possible addition of COPYXINVERT, COPYYINVERT and COPYZINVERT to invert that particular input (if on).
- LOCAL (bool): Only for constraints which Armature targets.
- Used by Copy Size (COPYSIZE) constraint:
- COPY (bitfield): any combination of COPYX, COPYY and COPYZ