GPv3: Preparation for retrieving falloff factor in multi frame editing mode #118108

Merged
Falk David merged 5 commits from SietseB/blender:gpv3-calculate-multi-frame-falloff into main 2024-02-13 12:04:54 +01:00
Member

This PR prepares GPv3 for calculating falloff factors when working in
multi frame editing mode.

The falloff popover is added to the UI.
A float multi_frame_falloff is added to MutableDrawingInfo. This
is a factor from 0.0 to 1.0f.
A retrieve_editable_drawings_with_falloff() is added to the utility
functions, which retrieves the falloff factor for each drawing when
multi frame falloff is enabled.

For technical reasons the return type of
retrieve_editable_drawings() and friends is changed from
Array<MutableDrawingInfo> to Vector<MutableDrawingInfo>.
Array as return type could give undefined results.

This PR prepares GPv3 for calculating falloff factors when working in multi frame editing mode. The falloff popover is added to the UI. A `float multi_frame_falloff` is added to `MutableDrawingInfo`. This is a factor from 0.0 to 1.0f. A `retrieve_editable_drawings_with_falloff()` is added to the utility functions, which retrieves the falloff factor for each drawing when multi frame falloff is enabled. For technical reasons the return type of `retrieve_editable_drawings()` and friends is changed from `Array<MutableDrawingInfo>` to `Vector<MutableDrawingInfo>`. Array as return type could give undefined results.
Sietse Brouwer added 1 commit 2024-02-11 18:00:31 +01:00
Sietse Brouwer added this to the Grease Pencil project 2024-02-11 18:00:51 +01:00
Sietse Brouwer requested review from Falk David 2024-02-11 18:01:03 +01:00
Sietse Brouwer changed title from GPv3: Preperation for retrieving falloff factor in multi frame editing mode to GPv3: Preparation for retrieving falloff factor in multi frame editing mode 2024-02-11 21:24:14 +01:00
Falk David added 1 commit 2024-02-12 10:29:32 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
67e8c053f8
Merge branch 'main' into gpv3-calculate-multi-frame-falloff
Member

@blender-bot build

@blender-bot build
Falk David requested changes 2024-02-12 11:58:57 +01:00
Falk David left a comment
Member

Some cleanup comments.

Some cleanup comments.
@ -7993,14 +8001,13 @@ class VIEW3D_PT_gpencil_multi_frame(Panel):
layout = self.layout
tool_settings = context.tool_settings
gpd = context.gpencil_data
Member

Hm this would change the old grease pencil panel. It's probably better to create a new VIEW3D_PT_grease_pencil_multi_frame panel to seperate the two.

Hm this would change the old grease pencil panel. It's probably better to create a new `VIEW3D_PT_grease_pencil_multi_frame` panel to seperate the two.
SietseB marked this conversation as resolved
@ -187,0 +191,4 @@
const int max_frame,
const CurveMapping *falloff_curve)
{
float falloff, frame_factor = 0.5f;
Member

In the new style guide (https://developer.blender.org/docs/handbook/guidelines/c_cpp/#variable-scope) we want to avoid variables with a larger scope than they need.

In the new style guide (https://developer.blender.org/docs/handbook/guidelines/c_cpp/#variable-scope) we want to avoid variables with a larger scope than they need.
SietseB marked this conversation as resolved
@ -187,0 +199,4 @@
/* Frame right of the center frame. */
if (frame_number > center_frame) {
frame_factor = 0.5f * float(center_frame - min_frame) / (frame_number - min_frame);
Member

-> const float frame_factor

-> `const float frame_factor`
SietseB marked this conversation as resolved
@ -187,0 +200,4 @@
/* Frame right of the center frame. */
if (frame_number > center_frame) {
frame_factor = 0.5f * float(center_frame - min_frame) / (frame_number - min_frame);
falloff = BKE_curvemapping_evaluateF(falloff_curve, 0, frame_factor);
Member

Instead of assigning to falloff, just return here.

Instead of assigning to `falloff`, just `return` here.
SietseB marked this conversation as resolved
@ -187,0 +203,4 @@
falloff = BKE_curvemapping_evaluateF(falloff_curve, 0, frame_factor);
}
/* Frame left of the center frame. */
else if (frame_number < center_frame) {
Member

This can be just an if when we return above.

This can be just an `if` when we return above.
SietseB marked this conversation as resolved
@ -187,0 +208,4 @@
falloff = BKE_curvemapping_evaluateF(falloff_curve, 0, frame_factor + 0.5f);
}
/* Frame at center. */
else {
Member

This else just becomes a return.

This `else` just becomes a `return`.
SietseB marked this conversation as resolved
Sietse Brouwer added 3 commits 2024-02-13 10:13:44 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
c0f11e1aa1
Cleanup: Immediate returns in falloff function
Falk David approved these changes 2024-02-13 11:02:09 +01:00
Falk David left a comment
Member

Code looks good to me now, thanks :)

Code looks good to me now, thanks :)
Member

@blender-bot build

@blender-bot build
Lukas Tönne approved these changes 2024-02-13 11:10:36 +01:00
Falk David merged commit 2f0b293da3 into main 2024-02-13 12:04:54 +01:00
Sietse Brouwer deleted branch gpv3-calculate-multi-frame-falloff 2024-02-13 19:59:21 +01: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
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#118108
No description provided.