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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_fcurve.c')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c67
1 files changed, 57 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 2802665c639..e69e2cd0e2c 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -24,12 +24,15 @@
#include <stdlib.h>
+#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_types.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
#include "DNA_anim_types.h"
+#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "MEM_guardedalloc.h"
@@ -50,7 +53,7 @@ EnumPropertyItem fmodifier_type_items[] = {
#ifdef RNA_RUNTIME
-/* --------- */
+#include "WM_api.h"
static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
{
@@ -80,6 +83,33 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
/* ****************************** */
+#include "BKE_depsgraph.h"
+
+static void rna_ChannelDriver_update_data(bContext *C, PointerRNA *ptr)
+{
+ ID *id= ptr->id.data;
+
+ // TODO: this really needs an update guard...
+ DAG_scene_sort(CTX_data_scene(C));
+ DAG_id_flush_update(id, OB_RECALC_DATA);
+
+ WM_event_add_notifier(C, NC_SCENE, id);
+}
+
+/* ----------- */
+
+static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr)
+{
+ DriverTarget *dtar= (DriverTarget*)ptr->data;
+ return ID_code_to_RNA_type(dtar->idtype);
+}
+
+static int rna_DriverTarget_id_editable(PointerRNA *ptr)
+{
+ DriverTarget *dtar= (DriverTarget*)ptr->data;
+ return (dtar->idtype)? PROP_EDITABLE : 0;
+}
+
static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value)
{
DriverTarget *dtar= (DriverTarget *)ptr->data;
@@ -157,7 +187,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem prop_mode_items[] = {
+ static EnumPropertyItem generator_mode_items[] = {
{FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""},
{FCM_GENERATOR_POLYNOMIAL_FACTORISED, "POLYNOMIAL_FACTORISED", 0, "Factorised Polynomial", ""},
{0, NULL, 0, NULL, NULL}};
@@ -174,7 +204,7 @@ static void rna_def_fmodifier_generator(BlenderRNA *brna)
// XXX this has a special validation func
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_enum_items(prop, generator_mode_items);
RNA_def_property_ui_text(prop, "Mode", "Type of generator to use.");
RNA_def_property_update(prop, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
@@ -521,19 +551,34 @@ static void rna_def_drivertarget(BlenderRNA *brna)
/* Variable Name */
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_struct_name_property(srna, prop);
- RNA_def_property_ui_text(prop, "Name", "Name to use in scripted expressions/functions.");
-
- /* Target Properties */
- prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_ui_text(prop, "Object", "Object the specific property used can be found from");
-
+ RNA_def_property_ui_text(prop, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)");
+ //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
+
+ /* Target Properties - ID-block to Drive */
+ prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_DriverTarget_id_typef");
+ RNA_def_property_ui_text(prop, "ID", "ID-block that the specific property used can be found from");
+ //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
+
+ prop= RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+ 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_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
+
+ /* Target Properties - Property to Drive */
prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length", "rna_DriverTarget_RnaPath_set");
RNA_def_property_ui_text(prop, "RNA Path", "RNA Path (from Object) to property used");
+ //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property used (if applicable)");
+ //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
}
static void rna_def_channeldriver(BlenderRNA *brna)
@@ -555,10 +600,12 @@ static void rna_def_channeldriver(BlenderRNA *brna)
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, "Type", "Driver types.");
+ RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data");
/* String values */
prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression.");
+ //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates
/* Collections */
prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);