GPv3: Drawing attribute API functions #119080

Open
opened 2024-03-05 11:19:38 +01:00 by Falk David · 0 comments
Member

The Grease Pencil Drawings have many attributes that are built-in (e.g. they are used by the renderer, operators or modifiers). When one wants to use them in code, one has to lookup other places in the code to know what the name and the type of the attribute is. This is not ideal.

To avoid this, we should add new API endpoints to the Drawing with the built-in attributes (e.g. used by the renderer, operators, etc.)

Here is a list of these attributes:

Name Type Domain Default Note
".selection" bool Point/Curve true All curves are treated as selected when this attribute does not exist.
"position" float3 Point -
"radius" float Point 0.01f
"opacity" float Point 0.0f
"vertex_color" GeometryColor4f Point ColorGeometry4f(0.0) The alpha value is used to mix in the base material color (0 means only the material color is used).
"rotation" float Point 0.0f This is the rotation of a texture on the point.
"delta_time" float Point 0.0f Written while drawing. The time difference in the time this point was added and the time the previous one was added. Used by the build modifier to "replay" how the stroke was draw.
"cyclic" bool Curve false
"start_cap" int8_t Curve GP_STROKE_CAP_TYPE_ROUND Enum of type GreasePencilStrokeCapType.
"end_cap" int8_t Curve GP_STROKE_CAP_TYPE_ROUND Enum of type GreasePencilStrokeCapType.
"hardness" float Curve 1.0f Used to render a soft gradient from the center line of the stroke to the edge.
"curve_type" int8_t Curve CURVE_TYPE_POLY Enum of type CurveType.
"aspect_ratio" float Curve 1.0f Value used to scale the x and y of textures on vertices. The aspect ratio is x / y where y is clamped to a minimum of 1e-7.
"fill_color" ColorGeometry4f Curve ColorGeometry4f(0.0) The alpha value is used to mix in the base material color (0 means only the material color is used).
"material_index" int Curve 0
"init_time" float Curve 0.0f Written while drawing. The timestamp at which this stroke was created. Used by the build modifier to "replay" how strokes were drawn.
The Grease Pencil Drawings have many attributes that are built-in (e.g. they are used by the renderer, operators or modifiers). When one wants to use them in code, one has to lookup other places in the code to know what the name and the type of the attribute is. This is not ideal. To avoid this, we should add new API endpoints to the `Drawing` with the built-in attributes (e.g. used by the renderer, operators, etc.) Here is a list of these attributes: | Name | Type | Domain | Default | Note | | --------- | --------- | ------------ | ------------ | ------- | | `".selection"` | `bool` | `Point`/`Curve` | `true` | All curves are treated as selected when this attribute does not exist. | | `"position"` | `float3` | `Point` | - | | Assumed to be always present. | | `"radius"` | `float` | `Point` | `0.01f` | | | `"opacity"` | `float` | `Point` | `0.0f` | | | `"vertex_color"` | `GeometryColor4f` | `Point` | `ColorGeometry4f(0.0)` | The alpha value is used to mix in the base material color (`0` means only the material color is used). | | `"rotation"` | `float` | `Point` | `0.0f` | This is the rotation of a texture on the point. | | `"delta_time"` | `float` | `Point` | `0.0f` | Written while drawing. The time difference in the time this point was added and the time the previous one was added. Used by the build modifier to "replay" how the stroke was draw. | | `"cyclic"` | `bool` | `Curve` | `false` | | | `"start_cap"` | `int8_t` | `Curve` | `GP_STROKE_CAP_TYPE_ROUND` | Enum of type `GreasePencilStrokeCapType`. | | `"end_cap"` | `int8_t` | `Curve` | `GP_STROKE_CAP_TYPE_ROUND` | Enum of type `GreasePencilStrokeCapType`. | | `"hardness"` | `float` | `Curve` | `1.0f` | Used to render a soft gradient from the center line of the stroke to the edge. | | `"curve_type"` | `int8_t` | `Curve` | `CURVE_TYPE_POLY` | Enum of type `CurveType`. | | `"aspect_ratio"` | `float` | `Curve` | `1.0f` | Value used to scale the x and y of textures on vertices. The aspect ratio is `x / y` where `y` is clamped to a minimum of 1e-7. | | `"fill_color"` | `ColorGeometry4f` | `Curve` | `ColorGeometry4f(0.0)` | The alpha value is used to mix in the base material color (`0` means only the material color is used). | | `"material_index"` | `int` | `Curve` | `0` | | | `"init_time"` | `float` | `Curve` | `0.0f` | Written while drawing. The timestamp at which this stroke was created. Used by the build modifier to "replay" how strokes were drawn. |
Falk David added the
Type
To Do
label 2024-03-05 11:19:38 +01:00
Falk David added this to the Grease Pencil project 2024-03-05 11:19:41 +01:00
Sign in to join this conversation.
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
1 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#119080
No description provided.