GPv3: UI and RNA for layer opacity #110177

Merged
Falk David merged 3 commits from casey-bianco-davis/blender:GPv3-layer-opacity-ui into main 2023-07-19 17:34:14 +02:00

Adds the UI for layer opacity in the layer panel.

Currently layer blending rendering is not implemented, so the last layer's opacity will affect all of the layers.

Adds the UI for layer opacity in the layer panel. Currently layer blending rendering is not implemented, so the last layer's opacity will affect all of the layers.
casey-bianco-davis added 1 commit 2023-07-16 21:09:09 +02:00
0683362d5d GPv3: UI and RNA for layer opacity
Adds the UI for layer opacity in the layer panel.

Currently layer blending rendering is not implemented, so the last layer's opacity will affect all of the layers.
Iliya Katushenock added this to the Grease Pencil project 2023-07-16 21:10:26 +02:00
Iliya Katushenock added the
Interest
User Interface
label 2023-07-16 21:10:42 +02:00
Falk David requested changes 2023-07-17 18:24:13 +02:00
Falk David left a comment
Member

Thank you for this! Changes look good in general, just two small comments.

Thank you for this! Changes look good in general, just two small comments.
@ -49,1 +49,4 @@
ob = context.object
grease_pencil = context.grease_pencil
gpl = grease_pencil.layers.active
Member

gpl -> layer

`gpl` -> `layer`
casey-bianco-davis marked this conversation as resolved
@ -60,0 +66,4 @@
col = layout.column(align=True)
if gpl:
layout = self.layout
Member

This line is not needed.

This line is not needed.
casey-bianco-davis marked this conversation as resolved
casey-bianco-davis added 1 commit 2023-07-17 22:29:14 +02:00
casey-bianco-davis requested review from Falk David 2023-07-17 22:30:15 +02:00
Member

Old files should be versioned so that the opacity is at a reasonable value:

diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc
index 21131234c87..ee9c18afa44 100644
--- a/source/blender/blenloader/intern/versioning_400.cc
+++ b/source/blender/blenloader/intern/versioning_400.cc
@@ -28,6 +28,7 @@
 #include "BLI_set.hh"
 #include "BLI_string_ref.hh"
 
+#include "BKE_grease_pencil.hh"
 #include "BKE_idprop.hh"
 #include "BKE_main.h"
 #include "BKE_mesh_legacy_convert.h"
@@ -404,5 +405,12 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
         scene->r.im_format.flag &= ~R_IMF_FLAG_ZBUF_LEGACY;
       }
     }
+
+    /* Reset the layer opacity for all layers to 1. */
+    LISTBASE_FOREACH (GreasePencil *, grease_pencil, &bmain->grease_pencils) {
+      for (blender::bke::greasepencil::Layer *layer : grease_pencil->layers_for_write()) {
+        layer->opacity = 1.0f;
+      }
+    }
   }
 }
Old files should be versioned so that the opacity is at a reasonable value: ```diff diff --git a/source/blender/blenloader/intern/versioning_400.cc b/source/blender/blenloader/intern/versioning_400.cc index 21131234c87..ee9c18afa44 100644 --- a/source/blender/blenloader/intern/versioning_400.cc +++ b/source/blender/blenloader/intern/versioning_400.cc @@ -28,6 +28,7 @@ #include "BLI_set.hh" #include "BLI_string_ref.hh" +#include "BKE_grease_pencil.hh" #include "BKE_idprop.hh" #include "BKE_main.h" #include "BKE_mesh_legacy_convert.h" @@ -404,5 +405,12 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain) scene->r.im_format.flag &= ~R_IMF_FLAG_ZBUF_LEGACY; } } + + /* Reset the layer opacity for all layers to 1. */ + LISTBASE_FOREACH (GreasePencil *, grease_pencil, &bmain->grease_pencils) { + for (blender::bke::greasepencil::Layer *layer : grease_pencil->layers_for_write()) { + layer->opacity = 1.0f; + } + } } } ```
Falk David requested changes 2023-07-18 12:04:22 +02:00
Falk David left a comment
Member

Comment about versioning.

Comment about versioning.
casey-bianco-davis added 1 commit 2023-07-18 21:48:45 +02:00
casey-bianco-davis requested review from Falk David 2023-07-18 21:49:21 +02:00
Falk David approved these changes 2023-07-19 17:33:52 +02:00
Falk David left a comment
Member

Looks good.

Looks good.
Falk David merged commit 1629eb61a1 into main 2023-07-19 17:34:14 +02:00
Sign in to join this conversation.
No reviewers
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
2 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#110177
No description provided.