diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-11-13 04:04:01 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-11-13 04:04:01 +0300 |
commit | acd7225deaad3e0dcfaf14dd1328dd292bd592f0 (patch) | |
tree | 33aa31a8d29ad996c096a14086b0ae7b970cba42 /source/blender/makesrna | |
parent | e12f39d116eb87c541ec27f022cc52a35e62da8d (diff) |
Driver Editing Tweaks:
* Updating dependencies for drivers now clears the disabled status of the relevant Driver FCurve too
* Changing the type of ID-block used for Driver Targets and Keying Set Paths will now clear the pointer to the ID-block if it is of the wrong type.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_animation.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 23a9c48710e..3e7638b3d51 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -78,6 +78,16 @@ static int rna_ksPath_id_editable(PointerRNA *ptr) return (ksp->idtype)? PROP_EDITABLE : 0; } +static void rna_ksPath_id_type_set(PointerRNA *ptr, int value) +{ + KS_Path *data= (KS_Path*)(ptr->data); + + /* set the driver type, then clear the id-block if the type is invalid */ + data->idtype= value; + if ((data->id) && (GS(data->id->name) != data->idtype)) + data->id= NULL; +} + static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value) { KS_Path *ksp= (KS_Path *)ptr->data; @@ -179,6 +189,7 @@ static void rna_def_keyingset_path(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "idtype"); RNA_def_property_enum_items(prop, id_type_items); RNA_def_property_enum_default(prop, ID_OB); + RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL); RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used."); /* Group */ diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 294f38cf3f7..085f0030422 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -111,6 +111,16 @@ static int rna_DriverTarget_id_editable(PointerRNA *ptr) return (dtar->idtype)? PROP_EDITABLE : 0; } +static void rna_DriverTarget_id_type_set(PointerRNA *ptr, int value) +{ + DriverTarget *data= (DriverTarget*)(ptr->data); + + /* set the driver type, then clear the id-block if the type is invalid */ + data->idtype= value; + if ((data->id) && (GS(data->id->name) != data->idtype)) + data->id= NULL; +} + static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value) { DriverTarget *dtar= (DriverTarget *)ptr->data; @@ -568,6 +578,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "idtype"); RNA_def_property_enum_items(prop, id_type_items); RNA_def_property_enum_default(prop, ID_OB); + RNA_def_property_enum_funcs(prop, NULL, "rna_DriverTarget_id_type_set", NULL); RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used."); //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates |