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>2016-03-27 07:02:53 +0300
committerJoshua Leung <aligorith@gmail.com>2016-03-27 08:05:35 +0300
commit4b279815d562511443509cdfda7fe0e77666db67 (patch)
treeac98188a63e2d3a3ca78c7f2363e06db7bee6185
parent6caad32c1293b2452fe03ee728e5df62eb34c052 (diff)
Drivers: Add a "none" mode for use when adding drivers
Although it isn't currently exposed, this allows for the old behaviour, where an "empty" driver was added (without any target assigned yet). For this reason, it's also referred to as the "Manual" mode. There are also some attempts at improving the tooltips + names for the other modes (again, not shown anywhere yet)
-rw-r--r--source/blender/editors/animation/drivers.c18
-rw-r--r--source/blender/editors/include/ED_keyframing.h1
2 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c
index 65a235e88f6..1ebe4f48302 100644
--- a/source/blender/editors/animation/drivers.c
+++ b/source/blender/editors/animation/drivers.c
@@ -158,12 +158,16 @@ FCurve *verify_driver_fcurve(ID *id, const char rna_path[], const int array_inde
/* Mapping Types enum for operators */
// XXX: These names need reviewing
EnumPropertyItem prop_driver_create_mapping_types[] = {
- {CREATEDRIVER_MAPPING_1_N, "SINGLE_MANY", 0, "Single Target, Multiple Properties",
- "Use the picked item to drive all components of this property"},
- {CREATEDRIVER_MAPPING_1_1, "DIRECT", 0, "Single Item Only",
- "Use picked item to drive property under mouse"},
+ {CREATEDRIVER_MAPPING_1_N, "SINGLE_MANY", 0, "All from Target",
+ "Drive all components of this property using the target picked"},
+ {CREATEDRIVER_MAPPING_1_1, "DIRECT", 0, "Single from Target",
+ "Drive this component of this property using the target picked"},
{CREATEDRIVER_MAPPING_N_N, "MATCH", 0, "Match Indices",
"Create drivers for each pair of corresponding elements"},
+
+ // XXX: for all vs just one?
+ {CREATEDRIVER_MAPPING_NONE, "NONE", 0, "Manually Create Later",
+ "Create driver without assigning any targets yet"},
{0, NULL, 0, NULL, NULL}
};
@@ -300,9 +304,11 @@ int ANIM_add_driver_with_target(
}
RNA_id_pointer_create(src_id, &id_ptr2);
- if (RNA_path_resolve_property(&id_ptr2, src_path, &ptr2, &prop2) == false) {
+ if ((RNA_path_resolve_property(&id_ptr2, src_path, &ptr2, &prop2) == false) ||
+ (mapping_type == CREATEDRIVER_MAPPING_NONE))
+ {
/* No target - So, fall back to default method for adding a "simple" driver normally */
- return ANIM_add_driver(reports, dst_id, dst_path, dst_index, flag, driver_type);
+ return ANIM_add_driver(reports, dst_id, dst_path, dst_index, flag | CREATEDRIVER_WITH_DEFAULT_DVAR, driver_type);
}
/* handle curve-property mappings based on mapping_type */
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index eb21a431702..0c04a45d9d9 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -240,6 +240,7 @@ typedef enum eCreateDriver_MappingTypes {
CREATEDRIVER_MAPPING_1_N = 0, /* 1 to Many - Use the specified index, and drive all elements with it */
CREATEDRIVER_MAPPING_1_1 = 1, /* 1 to 1 - Only for the specified index on each side */
CREATEDRIVER_MAPPING_N_N = 2, /* Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
+ CREATEDRIVER_MAPPING_NONE = 3, /* None - Do not create driver with any targets; these will get added later instead, when more convenient */
} eCreateDriver_MappingTypes;
/* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */