Page MenuHome

ctrl-clicking visibility keyframes only parent
Closed, ResolvedPublic

Description

System Information
Bodhi linux 2.4.0, GeForce GTX 480

Blender Version
Broken: 2.71 9337574
Worked: (optional)

Short description of error
In outliner ctrl-clicking the visibility icon (or renderable) hides or shows both parent and childs. Only the parent gets keyframed though.

Exact steps for others to reproduce the error

  1. With default scene create an empty and parent this to the cube.
  2. turn on auto keyframing
  3. insert keyframes for visibility (and render) for both Empty and Cube.
  4. go forward a few frames and crtl+click the eye icon of the Empty (parent). See this turn off and get yellow. See Cube (child) turn off but remain green. step forward and see parent still hidden while child snaps back to visible...

Event Timeline

David Rylander (animationista) raised the priority of this task from to Needs Triage by Developer.
Bastien Montagne (mont29) claimed this task.
Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.

Dev note: issue is that recursive children handling here is done completely outside of usual UI/buttons code, which does handle autokeyframing.

Here is a patch that fixes the issue. Only half happy with it though, have the feeling it adds quite a bit of overhead, and is not really generic either (though I did checked other 'recursive' stuff here, think only object hide/render_hide are relevant).

1diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
2index 7eb9095..e033f78 100644
3--- a/source/blender/editors/space_outliner/outliner_draw.c
4+++ b/source/blender/editors/space_outliner/outliner_draw.c
5@@ -29,6 +29,7 @@
6 * \ingroup spoutliner
7 */
8
9+#include "DNA_anim_types.h"
10 #include "DNA_armature_types.h"
11 #include "DNA_group_types.h"
12 #include "DNA_lamp_types.h"
13@@ -46,6 +47,7 @@
14 #include "BKE_context.h"
15 #include "BKE_deform.h"
16 #include "BKE_depsgraph.h"
17+#include "BKE_fcurve.h"
18 #include "BKE_global.h"
19 #include "BKE_library.h"
20 #include "BKE_main.h"
21@@ -55,6 +57,7 @@
22 #include "BKE_object.h"
23
24 #include "ED_armature.h"
25+#include "ED_keyframing.h"
26 #include "ED_object.h"
27 #include "ED_screen.h"
28
29@@ -168,7 +171,7 @@ static void restrictbutton_recursive_bone(bContext *C, bArmature *arm, Bone *bon
30 }
31
32 static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob_parent, char flag,
33- bool state, bool deselect)
34+ bool state, bool deselect, const char *rnapropname)
35 {
36 Main *bmain = CTX_data_main(C);
37 Object *ob;
38@@ -183,6 +186,33 @@ static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob
39 else {
40 ob->restrictflag &= ~flag;
41 }
42+
43+ if (rnapropname) {
44+ PointerRNA ptr;
45+ PropertyRNA *prop;
46+ ID *id;
47+ bAction *action;
48+ FCurve *fcu;
49+ bool driven;
50+
51+ RNA_id_pointer_create(&ob->id, &ptr);
52+ prop = RNA_struct_find_property(&ptr, rnapropname);
53+ fcu = rna_get_fcurve_context_ui(C, &ptr, prop, 0, &action, &driven);
54+
55+ if (fcu && !driven) {
56+ id = ptr.id.data;
57+ if (autokeyframe_cfra_can_key(scene, id)) {
58+ ReportList *reports = CTX_wm_reports(C);
59+ short flag = ANIM_get_keyframing_flags(scene, 1);
60+
61+ fcu->flag &= ~FCURVE_SELECTED;
62+ insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
63+ fcu->rna_path, fcu->array_index, CFRA, flag);
64+ /* Assuming this is not necessary here, since 'ancestor' object button will do it anyway. */
65+ /* WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); */
66+ }
67+ }
68+ }
69 }
70 }
71 }
72@@ -203,7 +233,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
73
74 if (CTX_wm_window(C)->eventstate->ctrl) {
75 restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_VIEW,
76- (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true);
77+ (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true, "hide");
78 }
79
80 WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
81@@ -226,7 +256,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
82
83 if (CTX_wm_window(C)->eventstate->ctrl) {
84 restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_SELECT,
85- (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true);
86+ (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true, NULL);
87 }
88
89 WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
90@@ -239,7 +269,7 @@ static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2)
91
92 if (CTX_wm_window(C)->eventstate->ctrl) {
93 restrictbutton_recursive_child(C, (Scene *)poin, ob, OB_RESTRICT_RENDER,
94- (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false);
95+ (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false, "hide_render");
96 }
97
98 WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, poin);

Joshua, afraid I have to summon you here.