Depsgraph: handle camera switching via markers in context drivers. #110139
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110139
Loading…
Reference in New Issue
No description provided.
Delete Branch "angavrilov:pr-depsgraph-marker-camera"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blender supports animating the active camera selection (i.e. the value of scene.camera) by binding cameras to markers in the timeline. The dependency graph was completely ignoring this by not building nodes for these cameras (it is possible to still reference a camera not directly linked in the scene any more), and not taking this into account in driver relations.
This change ensures that all cameras are included in the dependency graph, and any drivers referencing scene.camera get dependencies on all cameras of the timeline, and also time itself to ensure switches are processed.
I also include a commit that tags relations update from Set Active Object As Camera to fix a similar problem with ui actions.
The attached file demonstrates the marker problem: the cube tracks the X coordinate of the active camera via a context driver, and thus should always be centered. However, without the patch:
Camera
active the cube is still positioned atCamera.001
X coordinate (problem: no time dependency).Camera
is moved from UI (problem: no dependency onCamera
).e3358744ad
to4b3650965d
4b3650965d
to0c6b109eb3
0c6b109eb3
to37420d72d8
I'm not familiar enough yet with the dependency graph code to review this on a fine-grained level. But from a cursory look, if I'm understanding this correctly, it looks like it's adding all cameras on the timeline as dependencies for this kind of driver variable. Is that correct?
Speaking somewhat out of ignorance, that seems like a reasonable approach to me. And certainly this issue looks like a good thing to solve if we reasonably can.
The patch adds relations from all cameras used by markers to deriver variables which use scene's
camera
property. We do not Support dynamically changing relations during playback, so this is the only way to ensure evaluation order which is available.For the review itself.
It feels that
check_is_scene_camera_reference
could be improved from the local readability point of view. The best i came up with isget_rna_path_relative_to_scene_camera
. It shows the intent much better, and it could still return nullptr if the given property/path is not a scene camera.The camera linking state seems does not seem to be fully correct. Logically it should be
DEG_ID_LINKED_INDIRECTLY
as the camera is pulled as a dependency of a data-block and is not pulled in due to being explicitly in the collection hierarchy. It is already incorrect in thebuild_scene_render
, but i think it worth changing to what it is supposed to be (DEG_ID_LINKED_INDIRECTLY
) in all placesscene->camera
ormarker->camera
is build.I was testing the patch with some production shots, and did not see any unexpected regression.
37420d72d8
to31010a67a0
Fixed these.
Thanks for the update!
The change looks good for me now. Not sure if the animation module people would want to have a look before landing the change.
Nice improvement, just two small nags that can be addressed when landing the PR.
@ -33,6 +35,10 @@ class DepsgraphBuilder {
virtual bool check_pchan_has_bbone_segments(const Object *object, const bPoseChannel *pchan);
virtual bool check_pchan_has_bbone_segments(const Object *object, const char *bone_name);
static const char *get_rna_path_relative_to_scene_camera(const Scene *scene,
IMO this could use some documentation as to what kind of
rna_path
is expected, and to clarify that the returned pointer is eithernullptr
or points to a substring ofrna_path
.@ -1303,0 +1308,4 @@
{
LISTBASE_FOREACH (TimeMarker *, marker, &scene_->markers) {
if (!ELEM(marker->camera, nullptr, scene_->camera)) {
PointerRNA camera_ptr;
This is nesting too deeply. Better to extract this bit into a function of its own, which can then do precondition checks and
return
early instead.I extracted the loop to match the method structure of the relations builder, and added comments to split up the nested ifs better.
@ -2006,0 +1970,4 @@
Scene *scene,
const char *rna_path)
{
/* Add references to all cameras used in the timeline. */
Shouldn't this be the docstring for this function? It doesn't seem like an implementation detail to me.
None of the other methods here have docstrings, so I made the comment look more like an implementation detail :)
31010a67a0
tob248295530
Pull request closed