WorkSpaces link to non-ID library data (ViewLayer) #54140

Closed
opened 2018-02-23 04:03:59 +01:00 by Campbell Barton · 8 comments

Currently WorkSpaces.scene_viewlayer_relations link to ViewLayer via WorkSpaceDataRelation.value.

This works when the workspace and scene are stored in the same file, but crashes when a workspace & window is used to display a library linked scene.

In general this is something we don't support - referencing library pointers only works via ID's (I should have picked this up in initial review).

Checked on supporting this, but libraries don't have a datamap. This could be supported but is going outside the realm of what's reasonable regarding library loading. (snipped of kind of change that would be needed to support this - P622).


  • Suggest to use a string for the view layer as we do with bones.
  • An alternative solution would be to always ignore the workspace view layer with linked scenes, but this seems weak.
Currently `WorkSpaces.scene_viewlayer_relations` link to `ViewLayer` via `WorkSpaceDataRelation.value`. This works when the workspace and scene are stored in the same file, but crashes when a workspace & window is used to display a library linked scene. In general this is something we don't support - referencing library pointers only works via ID's *(I should have picked this up in initial review)*. Checked on supporting this, but libraries don't have a `datamap`. This could be supported but is going outside the realm of what's reasonable regarding library loading. (snipped of kind of change that would be needed to support this - [P622](https://archive.blender.org/developer/P622.txt)). ---- * Suggest to use a string for the view layer as we do with bones. * An alternative solution would be to always ignore the workspace view layer with linked scenes, but this seems weak.
Julian Eisel was assigned by Campbell Barton 2018-02-23 04:03:59 +01:00
Author
Owner

Added subscribers: @ideasman42, @JulianEisel

Added subscribers: @ideasman42, @JulianEisel

#54375 was marked as duplicate of this issue

#54375 was marked as duplicate of this issue

Added subscriber: @mont29

Added subscriber: @mont29

That should be known by now, indeed, never ever store pointers to non-ID data that do not belongs to same datablock. This is not supported, and we absolutely do not want to support it. At all.

Even the few cases where this is done currently (runtime-only, like e.g. object's pose storing pointers to armature's bones) are already a pain to handle in libdata management code.

So yes, using names is the correct solution here. And if you absolutely need to have runtime-only pointers (for performance reasons), then add functions to easily invalidate and rebuild those. And NULLify those pointers in readfile.c. But again, even that is a pain to handle correctly everywhere, so please only do it if absolutely necessary.

That should be known by now, indeed, **never ever store pointers to non-ID data that do not belongs to same datablock**. This is not supported, and we absolutely do not want to support it. At all. Even the few cases where this is done currently (runtime-only, like e.g. object's pose storing pointers to armature's bones) are already a pain to handle in libdata management code. So yes, using names is the correct solution here. And if you absolutely need to have **runtime-only** pointers (for performance reasons), then add functions to easily invalidate and rebuild those. And NULLify those pointers in readfile.c. But again, even that is a pain to handle correctly everywhere, so please only do it if absolutely necessary.
Member

Yes, seems like we can use names/identifiers. I can do this if you're not on it already?

The whole handling of the workspace view-layer has to be done rather carefully, easy to mess things up. That especially matters for the whole workspaces.blend idea. Appending a workspace from there should also somehow append settings for the viewport from this specific workspace.
I think that's exactly why I used the layer pointer in the first place: Back then my understanding was that we'd manage viewport render settings through view-layers, meaning we had to read them when appending somehow anyway. Now, what we do is storing the viewport settings directly in the workspace (which I still dislike a lot for various reasons), so indeed, now we can/should use identifiers.

I also have to admit that I was sure scene data-blocks couldn't be linked when coding this (thought only individual objects or groups could).... no idea where that came from, and I obviously also didn't double check that...

Yes, seems like we can use names/identifiers. I can do this if you're not on it already? The whole handling of the workspace view-layer has to be done rather carefully, easy to mess things up. That especially matters for the whole workspaces.blend idea. Appending a workspace from there should also somehow append settings for the viewport from this specific workspace. I think that's exactly why I used the layer pointer in the first place: Back then my understanding was that we'd manage viewport render settings through view-layers, meaning we had to read them when appending somehow anyway. Now, what we do is storing the viewport settings directly in the workspace (which I still dislike a lot for various reasons), so indeed, now we can/should use identifiers. I also have to admit that I was sure scene data-blocks couldn't be linked when coding this (thought only individual objects or groups could).... no idea where that came from, and I obviously also didn't double check that...

Added subscriber: @dfelinto

Added subscriber: @dfelinto
Author
Owner

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Author
Owner

Fixed d59b74adb3

Fixed d59b74adb3
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
5 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#54140
No description provided.