WIP: GPv3: Convert legacy objects on file load #108671

Closed
Falk David wants to merge 2 commits from filedescriptor/blender:convert-gpencil-legacy-to-gpv3-on-file-load into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

This converts the objects of type OB_GPENCIL_LEGACY to the new OB_GREASE_PENCIL type.

'Fixes' an issue where the "2D Animation" template would not behave as expected when using the "Grease Pencil 3.0" experimental option. Users found it to be confusing that the template would load with the old object type (and thus making it not possible to use at all).
Of course this will convert all the legacy grease pencil objects to the new type, but we might as well start doing this now, rather than later.

Currently I am unsure if the little BKE_reportf warning at the bottom of the screen is enough, since this will definitely break files. It is experimental yes, but if users forget to turn off the flag, they might accidentally corrupt files.

This converts the objects of type `OB_GPENCIL_LEGACY` to the new `OB_GREASE_PENCIL` type. 'Fixes' an issue where the "2D Animation" template would not behave as expected when using the "Grease Pencil 3.0" experimental option. Users found it to be confusing that the template would load with the old object type (and thus making it not possible to use at all). Of course this will convert all the legacy grease pencil objects to the new type, but we might as well start doing this now, rather than later. Currently I am unsure if the little `BKE_reportf` warning at the bottom of the screen is enough, since this will definitely break files. It is experimental yes, but if users forget to turn off the flag, they might accidentally corrupt files.
Falk David added 1 commit 2023-06-06 17:58:59 +02:00
Falk David added 1 commit 2023-06-06 18:01:49 +02:00
Falk David requested review from Brecht Van Lommel 2023-06-06 18:03:14 +02:00
Falk David requested review from Dalai Felinto 2023-06-06 18:03:14 +02:00
Falk David requested review from Bastien Montagne 2023-06-06 18:03:14 +02:00
Falk David changed title from GPv3: Convert legacy objects on file load to WIP: GPv3: Convert legacy objects on file load 2023-06-06 18:08:19 +02:00
Falk David added this to the Grease Pencil project 2023-06-06 18:13:08 +02:00
Bastien Montagne requested changes 2023-06-06 18:23:42 +02:00
Bastien Montagne left a comment
Owner

There are several issues with this patch, but not even sure it's the way to solve your issue?

Even though you do need conversion at some point, I would only enable it when it has been hard-tested and validated.

Why not rather have a GPv3 '2D Animation" template, and hide one or another depending on whether GPv3 experimental feature or not.

There are several issues with this patch, but not even sure it's the way to solve your issue? Even though you do need conversion at some point, I would only enable it when it has been hard-tested and validated. Why not rather have a GPv3 '2D Animation" template, and hide one or another depending on whether GPv3 experimental feature or not.
@ -899,1 +901,4 @@
/* Convert all `OB_GPENCIL_LEGACY` to `OB_GREASE_PENCIL`. */
if (mode != LOAD_UNDO && U.experimental.use_grease_pencil_version3 &&
!blendfile_or_libraries_versions_atleast(bmain, 400, 3))

This is most likely wrong, since user can still produce 'old' GP data currently in main?

This is most likely wrong, since user can still produce 'old' GP data currently in main?
@ -900,0 +903,4 @@
if (mode != LOAD_UNDO && U.experimental.use_grease_pencil_version3 &&
!blendfile_or_libraries_versions_atleast(bmain, 400, 3))
{
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {

Thish whole block should be its own function in GP BKE code, not exposed like that in generic readfile code.

Thish whole block should be its own function in GP BKE code, not exposed like that in generic readfile code.
@ -900,0 +917,4 @@
blender::bke::greasepencil::convert::legacy_gpencil_to_grease_pencil(
*bmain, *new_grease_pencil, *gpd);
id_us_min(&gpd->id);

You probably want to delete these old bGPdata IDs when they have no more users.

Another thing to consider here is what to do in case more than one GP object use the same bGPdata obdata.

In fact, I think what you should rather do here is loop over bGPdata IDs, make a new version of each, remap ID pointers, and then go over all GP objects to update their types?

You probably want to delete these old bGPdata IDs when they have no more users. Another thing to consider here is what to do in case more than one GP object use the same bGPdata obdata. In fact, I think what you should rather do here is loop over bGPdata IDs, make a new version of each, remap ID pointers, and then go over all GP objects to update their types?
Author
Member

Why not rather have a GPv3 '2D Animation" template, and hide one or another depending on whether GPv3 experimental feature or not.

Yes that could be an option depending on whether or not we want the automatic conversion for testing. Since it should only do the conversion when the experimental flag is set, I think we should not necessarily wait until it's well tested.

> Why not rather have a GPv3 '2D Animation" template, and hide one or another depending on whether GPv3 experimental feature or not. Yes that could be an option depending on whether or not we want the automatic conversion for testing. Since it should only do the conversion when the experimental flag is set, I think we should not necessarily wait until it's well tested.

I think doing this automatically when the experimental option is enabled is rather dangerous? I would do this only in versioning_defaults.cc, so that it only affects the startup files, not existing .blend files where it may be too late to notice the mistake.

Alternative, you could have a button in the 3D viewport header or something to do it, if the active object is a legacy grease pencil object.

I think doing this automatically when the experimental option is enabled is rather dangerous? I would do this only in `versioning_defaults.cc`, so that it only affects the startup files, not existing .blend files where it may be too late to notice the mistake. Alternative, you could have a button in the 3D viewport header or something to do it, if the active object is a legacy grease pencil object.
Author
Member

I will put this on hold for now and wait till we have more stable conversions.

I will put this on hold for now and wait till we have more stable conversions.
Brecht Van Lommel refused to review 2023-06-14 19:07:36 +02:00

Removing from my review queue then until this is meant to be reviewed.

Removing from my review queue then until this is meant to be reviewed.
Author
Member

Replaced by !118705. Closing.

Replaced by !118705. Closing.
Falk David closed this pull request 2024-03-28 12:45:55 +01:00

Pull request closed

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#108671
No description provided.