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>2010-05-27 11:37:09 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-05-27 11:37:09 +0400
commit8872cba7e956a9d9a840e55e5323945497524795 (patch)
tree6aaf3e97a13cc5b6fccbb1e2ad3bed27a8e3d2d8 /source/blender/makesrna/intern/rna_actuator.c
parent0db16ff434b4fb4ac35dd8d4525ee85c738528d1 (diff)
Logic Editor: removing usercount for existent datablocks
Using custom setfuncs to avoid increase/decrease of usercount. That way nothing stops you from removing a material that is used by a sensor, or a mesh, an action ... (this is how 2.49 works too) * also some general code cleaning/fix (adding static casts, replacing libaddr_us by lib_addr for dome text (I had no idea how user count worked back then)
Diffstat (limited to 'source/blender/makesrna/intern/rna_actuator.c')
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index e9da96e0960..8bad6957b1b 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -422,6 +422,23 @@ static void rna_Actuator_Armature_update(Main *bmain, Scene *scene, PointerRNA *
constraint[0] = 0;
}
+/* note: the following set functions exists only to avoid id refcounting */
+static void rna_Actuator_editobject_mesh_set(PointerRNA *ptr, PointerRNA value)
+{
+ bActuator *act = (bActuator *)ptr->data;
+ bEditObjectActuator *eoa = (bEditObjectActuator *) act->data;
+
+ eoa->me = value.data;
+}
+
+static void rna_Actuator_action_action_set(PointerRNA *ptr, PointerRNA value)
+{
+ bActuator *act = (bActuator *)ptr->data;
+ bActionActuator *aa = (bActionActuator *) act->data;
+
+ aa->me = value.data;
+}
+
#else
void rna_def_actuator(BlenderRNA *brna)
@@ -481,6 +498,8 @@ static void rna_def_action_actuator(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Action");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Action", "");
+ /* note: custom set function is ONLY to avoid rna setting a user for this. */
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "continue_last_frame", PROP_BOOLEAN, PROP_NONE);
@@ -1222,6 +1241,8 @@ static void rna_def_edit_object_actuator(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "me");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Mesh", "Replace the existing, when left blank 'Phys' will remake the existing physics mesh");
+ /* note: custom set function is ONLY to avoid rna setting a user for this. */
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_editobject_mesh_set", NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "time", PROP_INT, PROP_NONE);
@@ -1688,6 +1709,8 @@ static void rna_def_shape_action_actuator(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Action");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Action", "");
+ /* note: custom set function is ONLY to avoid rna setting a user for this. */
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Actuator_action_action_set", NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL);
prop= RNA_def_property(srna, "continue_last_frame", PROP_BOOLEAN, PROP_NONE);