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:
-rw-r--r--release/scripts/startup/bl_ui/properties_constraint.py2
-rw-r--r--source/blender/blenkernel/intern/constraint.c5
-rw-r--r--source/blender/blenloader/intern/versioning_280.c22
-rw-r--r--source/blender/makesdna/DNA_constraint_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c7
5 files changed, 37 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py
index 310d35c6179..c972ce04cdf 100644
--- a/release/scripts/startup/bl_ui/properties_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_constraint.py
@@ -430,6 +430,8 @@ class ConstraintButtonsPanel:
row.prop(con, "use_y", text="Y")
row.prop(con, "use_z", text="Z")
+ layout.prop(con, "power")
+
row = layout.row()
row.prop(con, "use_offset")
row = row.row()
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 2ccfcf45e46..218dfbd7b14 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1882,6 +1882,7 @@ static void sizelike_new_data(void *cdata)
bSizeLikeConstraint *data = (bSizeLikeConstraint *)cdata;
data->flag = SIZELIKE_X | SIZELIKE_Y | SIZELIKE_Z | SIZELIKE_MULTIPLY;
+ data->power = 1.0f;
}
static void sizelike_id_looper(bConstraint *con, ConstraintIDFunc func, void *userdata)
@@ -1929,6 +1930,10 @@ static void sizelike_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
mat4_to_size(size, ct->matrix);
mat4_to_size(obsize, cob->matrix);
+ for (int i = 0; i < 3; i++) {
+ size[i] = powf(size[i], data->power);
+ }
+
if (data->flag & SIZELIKE_OFFSET) {
/* Scale is a multiplicative quantity, so adding it makes no sense.
* However, the additive mode has to stay for backward compatibility. */
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 194459a1eda..b2e171108d8 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -702,6 +702,16 @@ static void do_version_constraints_maintain_volume_mode_uniform(ListBase *lb)
}
}
+static void do_version_constraints_copy_scale_power(ListBase *lb)
+{
+ for (bConstraint *con = lb->first; con; con = con->next) {
+ if (con->type == CONSTRAINT_TYPE_SIZELIKE) {
+ bSizeLikeConstraint *data = (bSizeLikeConstraint *)con->data;
+ data->power = 1.0f;
+ }
+ }
+}
+
void do_versions_after_linking_280(Main *bmain)
{
bool use_collection_compat_28 = true;
@@ -3348,6 +3358,18 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
{
+ /* Added a power option to Copy Scale. */
+ if (!DNA_struct_elem_find(fd->filesdna, "bSizeLikeConstraint", "float", "power")) {
+ LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+ do_version_constraints_copy_scale_power(&ob->constraints);
+ if (ob->pose) {
+ LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) {
+ do_version_constraints_copy_scale_power(&pchan->constraints);
+ }
+ }
+ }
+ }
+
/* Versioning code until next subversion bump goes here. */
}
}
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 3abd5b4456e..c09ea400f4c 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -289,7 +289,7 @@ typedef struct bLocateLikeConstraint {
typedef struct bSizeLikeConstraint {
struct Object *tar;
int flag;
- int reserved1;
+ float power;
/** MAX_ID_NAME-2. */
char subtarget[64];
} bSizeLikeConstraint;
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index ef3ea19fa57..41ad94f6119 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1327,6 +1327,13 @@ static void rna_def_constraint_size_like(BlenderRNA *brna)
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, "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");
+
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", "Combine original scale with copied scale");