GPv3: Array Modifier #117836

Merged
Falk David merged 15 commits from ChengduLittleA/blender:gp3-mod-array into main 2024-02-16 14:04:12 +01:00
Member

Array modifier migrated to Grease Pencil v3.

(This is a re-submit of the previously reverted commit)

Array modifier migrated to Grease Pencil v3. (This is a re-submit of the [previously reverted](https://projects.blender.org/blender/blender/pulls/117722) commit)
YimingWu added the
Interest
Grease Pencil
Module
Grease Pencil
labels 2024-02-05 12:00:18 +01:00
YimingWu added 5 commits 2024-02-05 12:00:23 +01:00
Iliya Katushenock added this to the Grease Pencil project 2024-02-05 13:27:21 +01:00
Falk David requested review from Falk David 2024-02-05 15:20:46 +01:00
Falk David requested changes 2024-02-06 10:54:34 +01:00
Falk David left a comment
Member

Some more comments :)

Some more comments :)
@ -0,0 +94,4 @@
{
float3 offset;
if (mmd.flag & MOD_GREASE_PENCIL_ARRAY_USE_OFFSET) {
Member

Seems like the calculation for the offset should be below the if (use_object_offset) { since it's not used in there.

I would also avoid declaring variables, then writing to them. The style guide (https://developer.blender.org/docs/handbook/guidelines/c_cpp/#variable-scope) is to keep variable scope as small as possible.

In this case, calculating the offset can be written as:

const float3 offset = [&]() {
   if (mmd.flag & MOD_GREASE_PENCIL_ARRAY_USE_OFFSET) {
      return float3(mmd.offset) * elem_idx;
   }
   return float3(0.0f);
}();
Seems like the calculation for the `offset` should be below the `if (use_object_offset) {` since it's not used in there. I would also avoid declaring variables, then writing to them. The style guide (https://developer.blender.org/docs/handbook/guidelines/c_cpp/#variable-scope) is to keep variable scope as small as possible. In this case, calculating the offset can be written as: ``` const float3 offset = [&]() { if (mmd.flag & MOD_GREASE_PENCIL_ARRAY_USE_OFFSET) { return float3(mmd.offset) * elem_idx; } return float3(0.0f); }(); ```
ChengduLittleA marked this conversation as resolved
@ -0,0 +112,4 @@
if (mmd.flag & MOD_GREASE_PENCIL_ARRAY_USE_OFFSET) {
mat_offset[3] += mmd.offset;
}
const float4x4 obinv = math::invert(float4x4(ob.object_to_world));
Member

You should just be able to use ob.world_to_object.

You should just be able to use `ob.world_to_object`.
ChengduLittleA marked this conversation as resolved
@ -0,0 +117,4 @@
return mat_offset * obinv * float4x4(mmd.object->object_to_world);
}
return r_mat;
Member

No need for a r_mat varaible, just return math::from_location<float4x4>(offset);

No need for a `r_mat` varaible, just `return math::from_location<float4x4>(offset);`
ChengduLittleA marked this conversation as resolved
YimingWu added 1 commit 2024-02-06 13:09:46 +01:00
YimingWu added 1 commit 2024-02-06 13:10:17 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
c76528d840
Merge branch 'main' into gp3-mod-array
Falk David requested changes 2024-02-06 13:40:43 +01:00
Falk David left a comment
Member

One comment got lost, otherwise this looks ok to me

One comment got lost, otherwise this looks ok to me
@ -0,0 +92,4 @@
const int elem_idx,
const bool use_object_offset)
{
const float3 offset = [&]() {
Member

Since offset is not used in if (use_object_offset) {. move this below the if.

Since `offset` is not used in `if (use_object_offset) {`. move this below the `if`.
ChengduLittleA marked this conversation as resolved
Member

@blender-bot build

@blender-bot build
YimingWu added 1 commit 2024-02-07 02:53:53 +01:00
YimingWu added 1 commit 2024-02-16 02:59:51 +01:00
YimingWu added 2 commits 2024-02-16 03:05:13 +01:00
Falk David approved these changes 2024-02-16 12:57:06 +01:00
Falk David left a comment
Member

Code looks ok to me. @ChengduLittleA Can you trigger the buildbot once this is merged with main again? Thanks.

Code looks ok to me. @ChengduLittleA Can you trigger the buildbot once this is merged with main again? Thanks.
Author
Member

Will do :D

Will do :D
YimingWu added 1 commit 2024-02-16 13:02:00 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
463ec67b12
Merge branch 'main' into gp3-mod-array
Author
Member

@blender-bot build

@blender-bot build
Member

Looks like there are some issues still.

Looks like there are some issues still.
YimingWu added 1 commit 2024-02-16 13:31:20 +01:00
YimingWu added 1 commit 2024-02-16 13:36:24 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
ebd2913743
Use `double(1.0f)` instead of 1.0d
Author
Member

@blender-bot build

@blender-bot build
Falk David reviewed 2024-02-16 13:59:54 +01:00
@ -0,0 +132,4 @@
if ((mmd.flag & MOD_GREASE_PENCIL_ARRAY_UNIFORM_RANDOM_SCALE) && j == 2) {
float rand_value;
rand_value = math::mod(r[0] * 2.0 - 1.0 + rand_offset, double(1.0f));
Member

double(1.0f) -> 1.0

`double(1.0f)` -> `1.0`
ChengduLittleA marked this conversation as resolved
YimingWu added 1 commit 2024-02-16 14:02:26 +01:00
Falk David merged commit 975c226282 into main 2024-02-16 14:04:12 +01:00
Falk David referenced this issue from a commit 2024-02-16 14:04:14 +01:00
Jeroen Bakker referenced this issue from a commit 2024-02-19 08:10:14 +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
2 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#117836
No description provided.