GPv3: Tint and Color modifiers #117297
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#117297
Loading…
Reference in New Issue
No description provided.
Delete Branch "LukasTonne/blender:gp3-color-modifier"
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?
Implements the Tint and Color (aka. "Hue/Saturation") modifiers.
Testing is difficult for fill colors currently due to lack of renderer support.
@ -0,0 +123,4 @@
for (const int64_t point_i : points) {
float3 factor = cmd.hsv;
if (use_curve) {
const float curve_input = points.size() >= 2 ? (float(point_i - points.first()) /
It's a bit nicer to iterate over
points.index_range()
to avoid the subtraction ofpoint_i - points.first()
:Did a first pass. Didn't find anything major, just some cleanups :)
@ -2542,11 +2544,10 @@ typedef enum GreasePencilModifierColorMode {
} GreasePencilModifierColorMode;
typedef enum GreasePencilOpacityModifierFlag {
MOD_GREASE_PENCIL_OPACITY_OPEN_INFLUENCE_PANEL = (1 << 0),
Looks like these changes are not meant to be part of this PR?
@ -7695,13 +7720,6 @@ static void rna_def_modifier_grease_pencil_opacity(BlenderRNA *brna)
srna, "rna_GreasePencilOpacityModifier_vertex_group_name_set");
rna_def_modifier_grease_pencil_custom_curve(srna);
prop = RNA_def_property(srna, "open_influence_panel", PROP_BOOLEAN, PROP_NONE);
Maybe this one can also be put into another PR (or just committed as a cleanup)
@ -0,0 +45,4 @@
namespace blender {
using bke::greasepencil::Drawing;
using bke::greasepencil::FramesMapKey;
Looks like you're not using
FramesMapKey
. Same for the other modifier.@ -0,0 +104,4 @@
const GreasePencilColorModifierData &cmd,
bke::CurvesGeometry &curves,
const IndexMask &curves_mask,
const MutableSpan<ColorGeometry4f> point_colors)
point_colors
->vertex_colors
@ -0,0 +109,4 @@
const bool use_curve = (cmd.influence.flag & GREASE_PENCIL_INFLUENCE_USE_CUSTOM_CURVE);
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
Looks like you just need
attributes()
here.@ -0,0 +110,4 @@
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
VArray<int> stroke_materials =
const
@ -0,0 +167,4 @@
bke::CurvesGeometry &curves = drawing.strokes_for_write();
IndexMaskMemory mask_memory;
IndexMask curves_mask = modifier::greasepencil::get_filtered_stroke_mask(
const
@ -0,0 +198,4 @@
const int frame = scene->r.cfra;
GreasePencil *grease_pencil = geometry_set->get_grease_pencil_for_write();
if (grease_pencil == nullptr) {
This should be consistent with the other modifiers:
@ -0,0 +203,4 @@
}
IndexMaskMemory mask_memory;
IndexMask layer_mask = modifier::greasepencil::get_filtered_layer_mask(
const
@ -17,6 +17,7 @@
#include "BKE_geometry_set.hh"
#include "BKE_grease_pencil.hh"
#include "BKE_modifier.hh"
#include "BKE_screen.hh"
Same as the other comments: This can be it's own PR or just a cleanup commit :)
@ -0,0 +166,4 @@
const GreasePencilTintModifierData &tmd,
bke::CurvesGeometry &curves,
const IndexMask &curves_mask,
const MutableSpan<ColorGeometry4f> point_colors)
vertex_colors
@ -0,0 +173,4 @@
GREASE_PENCIL_INFLUENCE_INVERT_VERTEX_GROUP);
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
Looks like you don't need the
attributes_for_write()
here, justattributes()
.@ -0,0 +174,4 @@
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
bke::MutableAttributeAccessor attributes = curves.attributes_for_write();
VArray<int> stroke_materials =
const
@ -0,0 +390,4 @@
const int frame = scene->r.cfra;
GreasePencil *grease_pencil = geometry_set->get_grease_pencil_for_write();
if (grease_pencil == nullptr) {
Same comment here as for the other modifier :)
@ -0,0 +395,4 @@
}
IndexMaskMemory mask_memory;
IndexMask layer_mask = modifier::greasepencil::get_filtered_layer_mask(
const
@ -173,3 +173,3 @@
uiItemR(row, ptr, "use_custom_curve", UI_ITEM_NONE, "Custom Curve", ICON_NONE);
if (use_custom_curve) {
uiTemplateCurveMapping(row, ptr, "custom_curve", 0, false, false, false, false);
uiTemplateCurveMapping(layout, ptr, "custom_curve", 0, false, false, false, false);
Seems like this fixed a bug that I introduced :D Please commit separately as a fix :)
Tint and Color grease pencil modifiersto GPv3: Tint and Color modifiersQuickly tested this locally (with the
fill_color
rendering now in main). Seems to work apart from theGradient
option which has no effect.Getting some warnings:
Maybe some function is returning early, befrore
.finish()
is called?Fixed.
@ -0,0 +108,4 @@
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
bke::AttributeAccessor attributes = curves.attributes();
const VArray<int> stroke_materials =
Typically
*
is used instead of.varray
. Just a bit shorter@ -0,0 +134,4 @@
});
}
static void modify_fill_color(Object *ob,
Object *
->Object &
@ -0,0 +159,4 @@
fill_colors.finish();
}
static void modify_drawing(ModifierData *md, const ModifierEvalContext *ctx, Drawing &drawing)
use references, use const for
ModifierData
@ -0,0 +192,4 @@
bke::GeometrySet *geometry_set)
{
auto *cmd = reinterpret_cast<GreasePencilColorModifierData *>(md);
const Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
Other modifiers are using
grease_pencil.runtime.eval_frame
now@ -0,0 +172,4 @@
const OffsetIndices<int> points_by_curve = curves.points_by_curve();
bke::AttributeAccessor attributes = curves.attributes();
const VArray<int> stroke_materials =
*
here instead of.varray
too