GPv3: Drawing Placement #115602
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115602
Loading…
Reference in New Issue
No description provided.
Delete Branch "filedescriptor/blender:gpv3-drawing-placements"
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 PR adds the drawing placement modes from GPv2.
The drawing placement defines the depth (origin, view, surface, etc.) and a plane (view, cursor, xz, etc.).
This introduces a new helper class
DrawingPlacement
that does all of the internals to find the correct projection and just exposes a simple function to project from screen space to the drawing plane/surface.Note: Drawing on other strokes currently doesn't work, because GPv3 can't be rendered to image yet. We use the depth buffer of the grease pencil render result to find the right depth.
WIP: GPv3: Drawing Placementto GPv3: Drawing PlacementChanges to be documented once this is merged:
Replaced the
gpd.zdepth_offset
property with a toolsetting:gpencil_surface_offset
.I didn't get the change to test this yet, but I guess there are others doing that anyway. My only point is about structuring this in a more data-oriented way then-- currently storing all the necessary data in a class and processing one point at a time doesn't seem to scale well. It's hard to judge whether the redundancy/complexity of storing the inputs in a class is worth it, but at least the API should still allow doing more work at a time.
@ -30,0 +116,4 @@
ED_view3d_depth_override(depsgraph, region, view3d, nullptr, mode, &this->depth_cache_);
}
void DrawingPlacement::set_origin_to_nearest_stroke(const float2 co)
I'd structuring the API to process more than one element at a time. That's a principle of data oriented design-- there's rarely ever only one of something, and when there is, it's fast anyway because there's only one value. This would help to eliminate branching and decrease the overhead of "constant" operations per position.
Though we probably can't benefit from it much yet, since all the functions this uses process a single element at a time too.
In the case of
set_origin_to_nearest_stroke
we're just changing theorigin
of the drawing plane. So this is a one-time operation.For
project
I could add an API that would project multiple coordinates at a time.I'd probably just remove the 1 point at a time from the API to make it annoying to call, but this is fine too
@ -28,2 +31,4 @@
namespace blender::ed::greasepencil {
DrawingPlacement::DrawingPlacement(const Scene &scene,
const ARegion *region,
Looks like these aren't meant to be null ever, might as well make them references, even if you just store them as pointers again
@ -54,0 +59,4 @@
enum class DrawingPlacementPlane { View, Front, Side, Top, Cursor };
class DrawingPlacement {
private:
private
is redundant for classes@ -54,0 +92,4 @@
* Projects a screen space coordinate to the local drawing space.
*/
float3 project(const float2 co) const;
void project(const Span<float2> src, MutableSpan<float3> dst) const;
Remove const for by-value arguments in declarations
@ -54,0 +90,4 @@
/**
* Projects a screen space coordinate to the local drawing space.
*/
float3 project(const float2 co) const;
Here too, and above!
Note: Some changes need to be documented (#114419):