Cache line in timeline is not updated when changing active object #57929

Closed
opened 2018-11-19 12:31:24 +01:00 by Sergey Sharybin · 12 comments

System Information

Debian Buster 64bit, GTX1080 390.87

Blender Version

Broken: b0c463a274
Worked: don't know

Short description of error

Changing active object by clicking on object in viewport does not update cache line in timeline.

Exact steps for others to reproduce the error

Open attached file, play animation for some time (to make cache line obvious). Change active object to plane by clicking with selection mouse button on the plane in viewport. The timeline is not refreshed for until you zoom or pan in it.

timeline_cache.blend

**System Information** Debian Buster 64bit, GTX1080 390.87 **Blender Version** Broken: b0c463a274 Worked: don't know **Short description of error** Changing active object by clicking on object in viewport does not update cache line in timeline. **Exact steps for others to reproduce the error** Open attached file, play animation for some time (to make cache line obvious). Change active object to plane by clicking with selection mouse button on the plane in viewport. The timeline is not refreshed for until you zoom or pan in it. [timeline_cache.blend](https://archive.blender.org/developer/F5635436/timeline_cache.blend)
Author
Owner

Added subscriber: @Sergey

Added subscriber: @Sergey
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Philipp Oeser self-assigned this 2018-11-26 12:31:17 +01:00
Member

Confirmed, checking...

Confirmed, checking...
Philipp Oeser removed their assignment 2018-11-26 14:39:07 +01:00
Dalai Felinto was assigned by Philipp Oeser 2018-11-26 14:39:07 +01:00
Member

Added subscribers: @dfelinto, @brecht

Added subscribers: @dfelinto, @brecht
Member

It is not only the cache lines, this is also true for keyframes etc.

Checked notifiers and found:

  • ed_object_select_pick() does
    WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene)
    (ND_OB_SELECT is not listened to by action_listener() -- makes sense, we want update only on change of active object)

  • ED_object_base_activate() does
    WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, view_layer)
    (ND_OB_ACTIVE is listened to by action_listener() ), BUT:

  • if WM_event_add_notifier is called with NC_SCENE and a viewlayer (instead of a scene), then it passes (does nothing) in wm_event_do_notifiers() here .

This may all be done on purpose (code was similar when there were still scenelayers), but I wouldnt know why?

Note: if I just pass in the current scene it seems to survive (and then updates properly), see P836
(but like I said above: not sure if wmNotifier->reference needs to be the viewlayer / if this was done on purpose)

Also not sure if this is supposed to be handled by notifiers alone? (who else could be responsible for updates? DEG is not for UI, right? messagebus?)
@dfelinto : assigning to you, but maybe @brecht would also know?

It is not only the cache lines, this is also true for keyframes etc. Checked notifiers and found: - ed_object_select_pick() does `WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene)` (ND_OB_SELECT **is not** listened to by` action_listener()` -- makes sense, we want update only on change of active object) - ED_object_base_activate() does `WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, view_layer)` (ND_OB_ACTIVE **is** listened to by action_listener() ), BUT: - if `WM_event_add_notifier` is called with NC_SCENE and a viewlayer (instead of a scene), then it passes (does nothing) in [wm_event_do_notifiers() here ](https://developer.blender.org/diffusion/B/browse/blender2.8/source/blender/windowmanager/intern/wm_event_system.c;fea3451cf29d7133499db696bdc87210772a7284$478). This may all be done on purpose (code was similar when there were still scenelayers), but I wouldnt know why? Note: if I just pass in the current scene it seems to survive (and then updates properly), see [P836](https://archive.blender.org/developer/P836.txt) (but like I said above: not sure if wmNotifier->reference **needs** to be the viewlayer / if this was done on purpose) Also not sure if this is supposed to be handled by notifiers alone? (who else could be responsible for updates? DEG is not for UI, right? messagebus?) @dfelinto : assigning to you, but maybe @brecht would also know?

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@lichtwerk actually if the issue is probably either the message system (@ideasman42) or depsgraph (@Sergey).

@lichtwerk actually if the issue is probably either the message system (@ideasman42) or depsgraph (@Sergey).
Author
Owner

@dfelinto, duuuuuuude, not the whole universe is covered by the dependency graph. If that was a dependency graph problem, why would i make a report then? ;) This is a notifier system (not even a message bus, which has no message which means "active object has changed").

One thing which very confusing here is view_layer used as a reference (i think that's the term in Blender's notifier system) for NC_SCENE. To me this looks wrong at a lest. We should stick to a single reference type passed to a specific notifier. If we need to inform something about view_layer we should introduce NC_VIEW_LAYER.

@dfelinto, duuuuuuude, not the whole universe is covered by the dependency graph. If that was a dependency graph problem, why would i make a report then? ;) This is a notifier system (not even a message bus, which has no message which means "active object has changed"). One thing which very confusing here is `view_layer` used as a reference (i think that's the term in Blender's notifier system) for `NC_SCENE`. To me this looks wrong at a lest. We should stick to a single reference type passed to a specific notifier. If we need to inform something about `view_layer` we should introduce `NC_VIEW_LAYER`.
Member

OK, checked a little more:

  • in aeb8e81f27 ED_object_base_activate() was introduced
  • lots of calls previously going to ED_base_object_activate() were changed to go to ED_object_base_activate()

sooo, this is ED_base_object_activate() [used before aeb8e81f27]

void ED_base_object_activate(bContext *C, Base *base)
{
	Scene *scene = CTX_data_scene(C);
	/* sets scene->basact */
	BASACT = base;
	
	if (base) {
		/* XXX old signals, remember to handle notifiers now! */
		//		select_actionchannel_by_name(base->object->action, "Object", 1);
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
	}
	else
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
}

this is ED_object_base_activate() [as introduced in aeb8e81f27]


void ED_object_base_activate(bContext *C, Base *base)
{
	SceneLayer *sl = CTX_data_scene_layer(C);
	sl->basact = base;

	if (base) {
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, sl);
	}
	else {
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
	}
}

this is ED_object_base_activate() today [after viewlayer changes etc]

void ED_object_base_activate(bContext *C, Base *base)
{
	ViewLayer *view_layer = CTX_data_view_layer(C);
	view_layer->basact = base;

	if (base) {
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, view_layer);
	}
	else {
		WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL);
	}
	DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_SELECT_UPDATE);
}

So original state was passing a scene, I dont see a particular reason why this was changed?
If noone remembers, this might just be a mistake (I havent checked into render-layers branch for a particular commit)?
I assume it should be fine then to just pass a scene again like done in P836?

OK, checked a little more: - in aeb8e81f27 `ED_object_base_activate()` was introduced - lots of calls previously going to `ED_base_object_activate()` were changed to go to `ED_object_base_activate()` sooo, this is `ED_base_object_activate() `[used before aeb8e81f27] ``` void ED_base_object_activate(bContext *C, Base *base) { Scene *scene = CTX_data_scene(C); /* sets scene->basact */ BASACT = base; if (base) { /* XXX old signals, remember to handle notifiers now! */ // select_actionchannel_by_name(base->object->action, "Object", 1); WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); } else WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL); } ``` this is `ED_object_base_activate()` [as introduced in aeb8e81f27] ``` void ED_object_base_activate(bContext *C, Base *base) { SceneLayer *sl = CTX_data_scene_layer(C); sl->basact = base; if (base) { WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, sl); } else { WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL); } } ``` this is `ED_object_base_activate()` today [after viewlayer changes etc] ``` void ED_object_base_activate(bContext *C, Base *base) { ViewLayer *view_layer = CTX_data_view_layer(C); view_layer->basact = base; if (base) { WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, view_layer); } else { WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL); } DEG_id_tag_update(&CTX_data_scene(C)->id, DEG_TAG_SELECT_UPDATE); } ``` So original state was passing a scene, I dont see a particular reason why this was changed? If noone remembers, this might just be a mistake (I havent checked into render-layers branch for a particular commit)? I assume it should be fine then to just pass a scene again like done in [P836](https://archive.blender.org/developer/P836.txt)?

This issue was referenced by 00d438639d

This issue was referenced by 00d438639dab0370987c330296a3cbc0f4e388de
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Geez you are right, no idea why I passed something that was not a scene to the notifier. @lichtwerk your patch seems fine thanks for the fix. @Sergey only today I noticed you were the reporter ;)

Geez you are right, no idea why I passed something that was not a scene to the notifier. @lichtwerk your patch seems fine thanks for the fix. @Sergey only today I noticed you were the reporter ;)
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
4 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#57929
No description provided.