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:
authorDalai Felinto <dfelinto@gmail.com>2011-06-12 12:34:53 +0400
committerDalai Felinto <dfelinto@gmail.com>2011-06-12 12:34:53 +0400
commit6c15d28db2719d96ca4834fe4f5ccef51a76625b (patch)
tree9307707ff4c76cfbd93f81ea9ca087d5e8cd5d5d /source/blender/makesrna/intern/rna_controller.c
parent9095612b855c22ad809babbfa05902b2fee582f2 (diff)
Logic: clear "Script" when setting Script Controller mode to "Module"
The text datablock was linked to the controller. So even if the script was set to 'module' and saved, once linked/appended the object the script would come together. If someone wants to implement this "clear" only once the file is saved, please go ahead. But I believe it's ok to loose the script if you change it for module (and with the new datablock lookup it's straightforward/quick to reassign a textblock) -- bug not reported anywhere, from my own list
Diffstat (limited to 'source/blender/makesrna/intern/rna_controller.c')
-rw-r--r--source/blender/makesrna/intern/rna_controller.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_controller.c b/source/blender/makesrna/intern/rna_controller.c
index 92c762098c7..db5409bf7ef 100644
--- a/source/blender/makesrna/intern/rna_controller.c
+++ b/source/blender/makesrna/intern/rna_controller.c
@@ -87,6 +87,20 @@ static void rna_Controller_type_set(struct PointerRNA *ptr, int value)
}
}
+static void rna_Controller_mode_set(struct PointerRNA *ptr, int value)
+{
+ bController *cont= (bController *)ptr->data;
+ bPythonCont *pycon= (bPythonCont *)cont->data;
+
+ // if mode changed and previous mode were Script
+ if (value != pycon->mode && pycon->mode == CONT_PY_SCRIPT)
+ {
+ // clear script to avoid it to get linked with the controller
+ pycon->text = NULL;
+ }
+ pycon->mode = value;
+}
+
static int rna_Controller_state_number_get(struct PointerRNA *ptr)
{
bController *cont= (bController *)ptr->data;
@@ -222,6 +236,7 @@ void RNA_def_controller(BlenderRNA *brna)
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, python_controller_modes);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Controller_mode_set", NULL);
RNA_def_property_ui_text(prop, "Execution Method", "Python script type (textblock or module - faster)");
RNA_def_property_update(prop, NC_LOGIC, NULL);