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
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-01-02 07:14:17 +0300
committerJoshua Leung <aligorith@gmail.com>2010-01-02 07:14:17 +0300
commita7d268d38e348722977a9fcf72624af691e724cd (patch)
tree36b8374679b46ce301a301226326dcd3605a0557 /source/blender/makesrna/intern/rna_constraint.c
parentbbac520987e68492d27c12a2b863c7839309008b (diff)
Cessen Rigging Request: "Copy Transforms" Constraint
This constraint simply copies the transformation matrix of the target, and assigns it to the owner.
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c174
1 files changed, 102 insertions, 72 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index f9405dec531..5ec8d438c42 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -43,6 +43,7 @@ EnumPropertyItem constraint_type_items[] ={
{CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT_DATA, "Copy Location", ""},
{CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT_DATA, "Copy Rotation", ""},
{CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT_DATA, "Copy Scale", ""},
+ {CONSTRAINT_TYPE_TRANSLIKE, "COPY_TRANSFORMS", ICON_CONSTRAINT_DATA, "Copy Transforms", ""},
{CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT_DATA, "Limit Distance", ""},
{CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT_DATA, "Limit Location", ""},
{CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT_DATA, "Limit Rotation", ""},
@@ -151,6 +152,8 @@ static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
return &RNA_DampedTrackConstraint;
case CONSTRAINT_TYPE_SPLINEIK:
return &RNA_SplineIKConstraint;
+ case CONSTRAINT_TYPE_TRANSLIKE:
+ return &RNA_CopyTransformsConstraint;
default:
return &RNA_UnknownType;
}
@@ -647,6 +650,69 @@ static void rna_def_constraint_track_to(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
+static void rna_def_constraint_locate_like(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target.");
+
+ prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
+ RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
+
+ prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tar");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ 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_Constraint_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", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
+ RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
+ RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
+ RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
+ RNA_def_property_ui_text(prop, "Invert X", "Invert the X location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
+ RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+}
+
static void rna_def_constraint_rotate_like(BlenderRNA *brna)
{
StructRNA *srna;
@@ -703,20 +769,14 @@ static void rna_def_constraint_rotate_like(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
-static void rna_def_constraint_locate_like(BlenderRNA *brna)
+static void rna_def_constraint_size_like(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- srna= RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copies the location of the target.");
-
- prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
- RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
-
- RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
+ srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target.");
+ RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tar");
@@ -731,39 +791,50 @@ static void rna_def_constraint_locate_like(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
- RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location.");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
+ RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
- RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location.");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
+ RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
- RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location.");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
+ RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
- RNA_def_property_ui_text(prop, "Invert X", "Invert the X location.");
+ prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
+ RNA_def_property_ui_text(prop, "Offset", "Add original scale into copied scale.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+}
- prop= RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
- RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+static void rna_def_constraint_transform_like(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
- prop= RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
- RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location.");
+ srna= RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copies all the transforms of the target.");
+ RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
+
+ prop= RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
+ RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1.");
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
- prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
- RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
+ 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_Constraint_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", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
}
static void rna_def_constraint_minmax(BlenderRNA *brna)
@@ -817,48 +888,6 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
}
-static void rna_def_constraint_size_like(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna= RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copies the scale of the target.");
- RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
-
- prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tar");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- 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_Constraint_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", "");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop= RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
- RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
-
- prop= RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
- RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
-
- prop= RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
- RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
-
- prop= RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
- RNA_def_property_ui_text(prop, "Offset", "Add original scale into copied scale.");
- RNA_def_property_update(prop, NC_OBJECT|ND_CONSTRAINT, "rna_Constraint_update");
-}
-
static void rna_def_constraint_action(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1869,6 +1898,7 @@ void RNA_def_constraint(BlenderRNA *brna)
rna_def_constraint_size_like(brna);
rna_def_constraint_locate_like(brna);
rna_def_constraint_rotate_like(brna);
+ rna_def_constraint_transform_like(brna);
rna_def_constraint_minmax(brna);
rna_def_constraint_track_to(brna);
rna_def_constraint_kinematic(brna);