ctrl-clicking visibility keyframes only parent #42163

Closed
opened 2014-10-09 23:27:39 +02:00 by David Rylander · 8 comments

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...
    ctrl-visibility.blend
**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... [ctrl-visibility.blend](https://archive.blender.org/developer/F115652/ctrl-visibility.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @animationista

Added subscriber: @animationista
Bastien Montagne self-assigned this 2014-10-10 09:38:21 +02:00

Added subscriber: @JoshuaLeung

Added subscriber: @JoshuaLeung

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).

P154: #42163

diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 7eb9095..e033f78 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -29,6 +29,7 @@
  *  \ingroup spoutliner
  */
 
+#include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
 #include "DNA_group_types.h"
 #include "DNA_lamp_types.h"
@@ -46,6 +47,7 @@
 #include "BKE_context.h"
 #include "BKE_deform.h"
 #include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
 #include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
@@ -55,6 +57,7 @@
 #include "BKE_object.h"
 
 #include "ED_armature.h"
+#include "ED_keyframing.h"
 #include "ED_object.h"
 #include "ED_screen.h"
 
@@ -168,7 +171,7 @@ static void restrictbutton_recursive_bone(bContext *C, bArmature *arm, Bone *bon
 }
 
 static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob_parent, char flag,
-                                           bool state, bool deselect)
+                                           bool state, bool deselect, const char *rnapropname)
 {
 	Main *bmain = CTX_data_main(C);
 	Object *ob;
@@ -183,6 +186,33 @@ static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob
 			else {
 				ob->restrictflag &= ~flag;
 			}
+
+			if (rnapropname) {
+				PointerRNA ptr;
+				PropertyRNA *prop;
+				ID *id;
+				bAction *action;
+				FCurve *fcu;
+				bool driven;
+
+				RNA_id_pointer_create(&ob->id, &ptr);
+				prop = RNA_struct_find_property(&ptr, rnapropname);
+				fcu = rna_get_fcurve_context_ui(C, &ptr, prop, 0, &action, &driven);
+
+				if (fcu && !driven) {
+					id = ptr.id.data;
+					if (autokeyframe_cfra_can_key(scene, id)) {
+						ReportList *reports = CTX_wm_reports(C);
+						short flag = ANIM_get_keyframing_flags(scene, 1);
+
+						fcu->flag &= ~FCURVE_SELECTED;
+						insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
+						                fcu->rna_path, fcu->array_index, CFRA, flag);
+						/* Assuming this is not necessary here, since 'ancestor' object button will do it anyway. */
+						/* WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); */
+					}
+				}
+			}
 		}
 	}
 }
@@ -203,7 +233,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
 
 	if (CTX_wm_window(C)->eventstate->ctrl) {
 		restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_VIEW,
-		                               (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true);
+		                               (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true, "hide");
 	}
 
 	WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -226,7 +256,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
 
 	if (CTX_wm_window(C)->eventstate->ctrl) {
 		restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_SELECT,
-		                               (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true);
+		                               (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true, NULL);
 	}
 
 	WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
@@ -239,7 +269,7 @@ static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2)
 
 	if (CTX_wm_window(C)->eventstate->ctrl) {
 		restrictbutton_recursive_child(C, (Scene *)poin, ob, OB_RESTRICT_RENDER,
-		                               (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false);
+		                               (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false, "hide_render");
 	}
 
 	WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, poin);

Joshua, afraid I have to summon you here.

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). [P154: #42163](https://archive.blender.org/developer/P154.txt) ``` diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 7eb9095..e033f78 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -29,6 +29,7 @@ * \ingroup spoutliner */ +#include "DNA_anim_types.h" #include "DNA_armature_types.h" #include "DNA_group_types.h" #include "DNA_lamp_types.h" @@ -46,6 +47,7 @@ #include "BKE_context.h" #include "BKE_deform.h" #include "BKE_depsgraph.h" +#include "BKE_fcurve.h" #include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" @@ -55,6 +57,7 @@ #include "BKE_object.h" #include "ED_armature.h" +#include "ED_keyframing.h" #include "ED_object.h" #include "ED_screen.h" @@ -168,7 +171,7 @@ static void restrictbutton_recursive_bone(bContext *C, bArmature *arm, Bone *bon } static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob_parent, char flag, - bool state, bool deselect) + bool state, bool deselect, const char *rnapropname) { Main *bmain = CTX_data_main(C); Object *ob; @@ -183,6 +186,33 @@ static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob else { ob->restrictflag &= ~flag; } + + if (rnapropname) { + PointerRNA ptr; + PropertyRNA *prop; + ID *id; + bAction *action; + FCurve *fcu; + bool driven; + + RNA_id_pointer_create(&ob->id, &ptr); + prop = RNA_struct_find_property(&ptr, rnapropname); + fcu = rna_get_fcurve_context_ui(C, &ptr, prop, 0, &action, &driven); + + if (fcu && !driven) { + id = ptr.id.data; + if (autokeyframe_cfra_can_key(scene, id)) { + ReportList *reports = CTX_wm_reports(C); + short flag = ANIM_get_keyframing_flags(scene, 1); + + fcu->flag &= ~FCURVE_SELECTED; + insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)), + fcu->rna_path, fcu->array_index, CFRA, flag); + /* Assuming this is not necessary here, since 'ancestor' object button will do it anyway. */ + /* WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); */ + } + } + } } } } @@ -203,7 +233,7 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) if (CTX_wm_window(C)->eventstate->ctrl) { restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_VIEW, - (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true); + (ob->restrictflag & OB_RESTRICT_VIEW) != 0, true, "hide"); } WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -226,7 +256,7 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2) if (CTX_wm_window(C)->eventstate->ctrl) { restrictbutton_recursive_child(C, scene, ob, OB_RESTRICT_SELECT, - (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true); + (ob->restrictflag & OB_RESTRICT_SELECT) != 0, true, NULL); } WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); @@ -239,7 +269,7 @@ static void restrictbutton_rend_cb(bContext *C, void *poin, void *poin2) if (CTX_wm_window(C)->eventstate->ctrl) { restrictbutton_recursive_child(C, (Scene *)poin, ob, OB_RESTRICT_RENDER, - (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false); + (ob->restrictflag & OB_RESTRICT_RENDER) != 0, false, "hide_render"); } WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, poin); ``` Joshua, afraid I have to summon you here.

This issue was referenced by 91d2485c52

This issue was referenced by 91d2485c526b98e368d78bb132a906ac11c899a1

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 91d2485c52.

Closed by commit 91d2485c52.
Author

Thank you!

Thank you!
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#42163
No description provided.