GPv3: Set Uniform operator for Thickness and Opacity #114006
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114006
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "antoniov/blender:GPv3_normalize"
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?
This operator has the same functionality that GPv2 version.
Note: The radius is set with the entry value. In GPv2 the radius
was relative to the stroke thickness. Maybe we need review this.
Related to #113991
@filedescriptor do you have a estimated date for the Undo? Now, check the operators is complex because the Undo is not working.
@ -951,0 +970,4 @@
{int(NormalizeMode::OPACITY),
"OPACITY",
0,
"OPacity",
Typo:
"Opacity"
@ -951,0 +1033,4 @@
}
else if (mode == NormalizeMode::OPACITY) {
opacities[point_i] = opacity;
CLAMP(opacities[point_i], 0.0f, 1.0f);
Use
math::clamp(...)
Removed the line because the paramter is filtered already.
Can we do changes suggested in #113991 (comment) ?
I'm not very confident about it but I guess it would avoid extra for loop of points there.
There are some unrelated formatting changes that need to be resolved, but otherwise, this looks good.
@ -951,0 +1019,4 @@
}
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
selected_curves.foreach_index([&](const int curve_index) {
Retrieve the attribute once outside of the loop, then affect it inside, without checking the mode.
Retrieving the attribute by name is very slow compared to everything else, and it also isn't threadsafe when retrieving with write access.
@ -951,0 +1026,4 @@
if (mode == NormalizeMode::THICKNESS) {
bke::curves::fill_points<float>(points_by_curve, selected_curves, radius, radii);
}
if (mode == NormalizeMode::OPACITY) {
else if
, or even betterswitch (mode)
so that adding a mode without changing this gives a compilation error@ -951,0 +961,4 @@
OPACITY,
};
static const EnumPropertyItem prop_normalize_modes[] = {
This can be defined inside of
GREASE_PENCIL_OT_stroke_normalize
@ -951,0 +1020,4 @@
}
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
MutableSpan<float> radii = drawing.radii_for_write();
Retrieve the necessary attribute in the call to
fill_points
.Getting an attribute with write access is potentially expensive. It's important to avoid it when possible.
_uniform_
to the operator name 56f7a111f7maybe changing the PR title to 'uniform' is also a good direction to uniform our heart
GPv3: Normalize Stroke operatorto GPv3: Set Uniform operator for Thickness and Opacity@ -960,0 +1014,4 @@
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* props */
ot->prop = RNA_def_float(
Seems that this should be exposed as "Thickness" and then divided by 2 before it's assigned to the points.
I'm not sure about that. The name "Radius" is the same name used in Blender for the brush size. If we use "Thickness" as a name, we are breaking the thickness logic of the Drawing. Actually, the thickness is the result of applying the radius.
@mendio What do you think here?
The thickness is twice the radius. And the operator is called "Set Thickness"
Yes, agree. What I mean is, if we use here Thickness then maybe we need change also Radius in the Draw operator, because the "thickness" of the stroke in DRaw mode is set using "radius" parameter.
My concern is to be sure we keep consistency, so I will wait, before change the name, for @mendio because he has been working all these years to keep consistency, so his opinion is important here. If all agree I can change it easily.
For the UI we use Radius and Strength names only in brush settings, once applied, it becomes Stroke Thickness and Stroke Opacity. So yes, Thickness fot the parameter is correct in this case because we are affecting an already existing stroke.
I have talked with @mendio and we agree to use Thickness instead of Radius.
@ -26,6 +27,9 @@
#include "ED_grease_pencil.hh"
#include "ED_screen.hh"
#include "UI_interface.hh"
Looks like these two UI includes are unnecessary
Correct! I would love for the Microsoft compiler to warn about these things as a warning, but it doesn't.