[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [37427] trunk/blender/source/blender/ makesrna/intern/rna_controller.c: Logic: clear "Script" when setting Script Controller mode to "Module"
Dalai Felinto
dfelinto at gmail.com
Sun Jun 12 10:34:54 CEST 2011
Revision: 37427
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=37427
Author: dfelinto
Date: 2011-06-12 08:34:53 +0000 (Sun, 12 Jun 2011)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/makesrna/intern/rna_controller.c
Modified: trunk/blender/source/blender/makesrna/intern/rna_controller.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_controller.c 2011-06-12 04:47:06 UTC (rev 37426)
+++ trunk/blender/source/blender/makesrna/intern/rna_controller.c 2011-06-12 08:34:53 UTC (rev 37427)
@@ -87,6 +87,20 @@
}
}
+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 @@
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);
More information about the Bf-blender-cvs
mailing list