Bugfix: Referencing actions from Action Actuator was not setting a user

This reverts the change made in 8872cba7e956a9d9a840e55e5323945497524795
which was contributing to actions being lost in some cases [1], even when
they were assigned to those actuaters, which needed them to be able to
function. Now there's one less case where users are needed but were missing :)

Note that this still doesn't solve the core issue where nothing is responsible
for associating actions created for a particular datablock (and not currently
being used in its active action slot, or in the NLA stack) with that datablock.
That issue is the cause of most action disappearances as well as for other problems
(such as renaming bones being unable to fix unreferenced/unused actions) where there
are diifferences between users' mental models and the data model. Proper fixes are
coming soon (restoring fake users here isn't a proper fix, as it only masks the
fundamental mismatch/problem here).


[1] http://blenderartists.org/forum/showthread.php?357021-BGE-loses-actions
This commit is contained in:
Joshua Leung 2015-02-14 02:48:36 +13:00
parent dde0765de2
commit ec2ede4302
2 changed files with 3 additions and 13 deletions

@ -4514,11 +4514,11 @@ static void lib_link_object(FileData *fd, Main *main)
} }
else if (act->type == ACT_ACTION) { else if (act->type == ACT_ACTION) {
bActionActuator *aa = act->data; bActionActuator *aa = act->data;
aa->act= newlibadr(fd, ob->id.lib, aa->act); aa->act= newlibadr_us(fd, ob->id.lib, aa->act);
} }
else if (act->type == ACT_SHAPEACTION) { else if (act->type == ACT_SHAPEACTION) {
bActionActuator *aa = act->data; bActionActuator *aa = act->data;
aa->act= newlibadr(fd, ob->id.lib, aa->act); aa->act= newlibadr_us(fd, ob->id.lib, aa->act);
} }
else if (act->type == ACT_PROPERTY) { else if (act->type == ACT_PROPERTY) {
bPropertyActuator *pa = act->data; bPropertyActuator *pa = act->data;

@ -531,14 +531,6 @@ static void rna_Actuator_editobject_mesh_set(PointerRNA *ptr, PointerRNA value)
eoa->me = value.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->act = value.data;
}
#else #else
static void rna_def_actuator(BlenderRNA *brna) static void rna_def_actuator(BlenderRNA *brna)
@ -618,10 +610,8 @@ static void rna_def_action_actuator(BlenderRNA *brna)
prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE); prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act"); RNA_def_property_pointer_sdna(prop, NULL, "act");
RNA_def_property_struct_type(prop, "Action"); RNA_def_property_struct_type(prop, "Action");
RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
RNA_def_property_ui_text(prop, "Action", ""); 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, NULL);
RNA_def_property_update(prop, NC_LOGIC, NULL); RNA_def_property_update(prop, NC_LOGIC, NULL);
prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE); prop = RNA_def_property(srna, "use_continue_last_frame", PROP_BOOLEAN, PROP_NONE);