User:Filedescriptor/Reports/2023

Weekly Reports 2023

February 06 - February 10 (week 1)

I tested and reviewed some critical fixes by Amélie Fondevilla:

  • D17214 Fix T104371: Grease Pencil merge down layer duplicates wrong frame
  • dc9f7fe64f Fix #104514: GPencil merge down layer misses some frames

This week I continued development of the (hair) curves edit mode. Although this seems very unrelated to grease pencil, curves make use of the CurvesGeometry structure which will be the core component for the upcoming GP 3.0 project. This work allows me to get familiar with the structure as well as the C++ patterns that are used. I made sure to also implement these features in a way that the code can be used by other objects that use CurvesGeometry. This means that GP 3.0 can use this code as well.

Next to the development work, I also planned, coordinated, and summarized some meetings. I also talked to Clément Foucault and Shen Ciao about grease pencil rendering.

I also began working on a principles documents for the upcoming grease pencil 3.0 project.

February 13 - February 17 (week 2)

This week I continued the work on the curves edit mode. With the addition of the toolbar and some fixes regarding the overlay drawing, it was ready to land for 3.5 and is now out of experimental.

  • 55843cd64b Curves: Add select more/less
  • 4fbc9c42e5 Curves: Add transform tools to toolbar
  • 715acf758c Curves: Use deformed points in edit mode overlay
  • d4f7f1dfe4 Curves: Fix memory leak in view3d_select
  • 7dbf2e2e95 Curves: Draw point overlay only in point selection mode
  • 8d20db0594 Curves: Fix curve segment selection

I also had some meetings regarding the GP 3.0 project and started to work on a technical outline of the current plan that I will present to the team in Amsterdam in the next week.

February 20 - February 24 (week 3)

This week I mostly focused on fixing bugs in the new hair curves edit mode.

  • 33cbd063d3 Curves: Fix proportional editing not working
  • 8a135a9a5f Curves: Add cursor snapping support
  • 2fef2f707a Fix: Unable pick select first point/curve in Curves
  • 061d191677 Fix #105043: Add shortcut for proportional editing
  • 2e7bd1dfb1 Fix #105044: Crash when rotating hair curves
  • 059ba28b29 Fix #105026: Texture space operators in transform menu
  • PR #105184 Fix #105109: Pick selection with multi object edit

Next to patching bugs I began working on the Duplicate operator.

I also organized the Grease Pencil Module meeting and finished the technical outline of the GP 3.0 project. This plan will be presented to the team in Amsterdam next week.

February 27 - March 03 (week 4)

This week, I was in Amsterdam at Blender and mostly worked on the technical design of Grease Pencil 3.0. After multiple meetings throughout the week with Bastien, Brecht, Dalai, Francesco, Julien, Sergey, and more, this is the design that was approved:

I also planned the next 5 weeks or so of development with some target milestones. The goal is to confirm the performance improvements that we expect from this new design.

I also committed some fixes to curves edit mode:

  • 00ca7c5221 Fix #105109: Pick selection with multi object edit
  • e6af81c536 Fix #105028: No update exiting curves edit mode

March 06 - March 10 (week 5)

Due to the strike in France this week, I ended up spending Wednesday and Thursday in Amsterdam. I was also sick on Friday.

I began the work on the Grease Pencil 3.0 project this week by doing some refactoring:

  • 53bb713eda Refactor: Rename OB_GPENCIL and ID_GD
  • PR #105597 Refactor: Rename grease pencil files to legacy

I created a local branch for adding the new data-block and object called grease-pencil-v3. This branch might get pushed to the main repository for the initial development.

I also organized the module meeting as well as a meeting specifically on the future of LineArt:

March 13 - March 17 (week 6)

I began the week with some more refactoring.

  • 2788fa915b Refactor: CurvesGeometry read/write function
  • df0c2693b6 Refactor: Rename grease pencil files to legacy

Then I spent the rest of the week working on the grease-pencil-v3 branch. Here is a summary of what I worked on:

  • DNA for the new data-block (DNA_grease_pencil_types.h). There were a couple of decisions made here.
    • the map structure for the frames in a layer is stored in DNA as an array of keys and an array of values. The map will then be created at runtime.
    • the layer tree is also created at runtime and stored in DNA as an array of tree nodes (pre-order serialization of the N-tree).
  • Classes for the layer tree:
    • There is now a TreeNode class that is the base class for the Layer and LayerGroup class. The TreeNode is used to store the tree data (every node owns the data of its children) and also for easy iteration and searching through the tree. The Layer class will give access to the frames data. The LayerGroup class has an API for adding layers and creating groups.
  • Conversion between a bGPDframe and a GreasePencilDrawing:
    • As of right now it supports the following attributes on the point domain: positions, radius, opacity, .selection (UI attribute). And the cyclic and material_index attributes on the curve domain.
    • I also began working on converting the layers, this is still WIP.

I tested the conversion function by converting a single frame to a drawing and storing it in a Curves object.


  • New grease pencil data-block and object.
    • Next to adding the data-block and object (still WIP), I made it possible to convert between the old and new object with the object_convert operator (WIP).
  • Tests
    • I added a test file. Right now this is just testing the TreeNode, Layer and LayerGroup classes. More individual tests need to be added.

March 20 - March 24 (week 7)

This week I spent most of my time setting up the rendering code for the new grease pencil data-block.

  • Continued working on the blend read and write. This seems to be fully functional now.
  • Fix the copying of the layer tree.
  • Copy materials when converting to the new object type.
  • Merged in the gpencil-next render engine. Use this render engine by default with the new object type.
  • Implement the initial draw caches for the new data type.

March 27 - March 31 (week 8)

This week I focused on rendering the new grease pencil data using the gpencil-next engine that Clément started to work on last year. I implemented fill triangulation on geometry evaluation and added functions for the batch cache creation (using multithreading now).

At the end of the week I was able to convert and play back the pirate test file here (simplified to not include effects, modifiers and layer adjustments).

Pirate test file with GP 3.png

The timings of the batch cache creation are roughly the same (~0.3ms faster on average) and the FPS while playback also is roughly the same. But the file size (compressed) went from around 40MiB to 18 MiB. This is a very good start as I did not spent any time on more optimizations yet.

I added an experimental option in the settings for grease pencil 3.0. It also switches the grease pencil engine. This means that with the option enabled, the current grease pencil objects are no longer rendered. I also began the work of draw mode and the draw operator.

My plan for the next week is to get a simple drawing operator working.

Committs:

April 3 - April 7 (week 9)

This week I focused on getting the next milestone of task #105540 done. I was able to write a simple drawing operator and also render the stroke while drawing. The goal for this initial drawing operator is mostly to have a real example to test performance with.

I also spent some time expanding the grease pencil data API and write more tests. This work will continue throughout the next weeks.

Finally, I began the last milestone for #105540: Performance tests. I hope that I can finish this next week.

April 10 - April 14 (week 10)

I began this week by completing the performance tests. The results can be found in the comment under the task here. After that, I worked on getting a full conversion of the data-block working. The progress of this is documented in the task #106822.

April 17 - April 21 (week 11)

This week I focused on making sure all the data in the grease pencil DNA is converted. The only thing missing as of now are the weights. This will have to be done on CurvesGeometry though. I also worked on writing the GP 3.0 blog post.

I also committed a small change to the remove_if functions of some BLI containers:

  • 66158498de BLI: Return number of values removed from remove_if

Finally, I reviewed and committed the following PR for Blender 3.6:

I was sick from Wednesday till the end of the week.

April 24 - April 28 (week 12)

May 01 - May 05 (week 13)

This week I was mostly working on the code review for PR #106848. A lot of the time was spent cleaning up the code. I also spend some time working on the blog post as well as having some design discussions with Dalai about the integration of Grease Pencil into Geometry Nodes.

May 08 - May 12 (week 14)

This week I got feedback from Bastien on the state of GP 3.0. He raised some concerns on how the layer tree was stored which meant that some of the API has to be rewritten. I spent most of the time working on this rewrite.

I had to take the last 3 days of the week off due to family reasons.

May 15 - May 19 (week 15)

May 22 - May 26 (week 16)

Note: I moved to Amsterdam at the end of the last week.

This week I finished the review of the GP 3.0 patch. There were a few back and forth with Bastien about the ID and RNA code of the new grease pencil. There was a crash when opening files saved with GP 3.0 objects that I fixed on Thursday.

May 29 - June 02 (week 17)

June 05 - June 09 (week 18)

I started this week by working on the (de)select all operator. The intent was to create an example of how to convert one of these operators to the new data-structure for other contributors to look at. I did the same for the "select box" operator for an interactive example. The interactive selection operators are defined for all objects so they work a bit differently. I then created multiple community tasks for people to work on. There were also multiple meetings this week. I had a session with Dalai to talk more about the integration of Grease Pencil into Geometry nodes. The results of that session were then presented to the geometry nodes team on two different occasions. We also had a meeting with some people from the animation module to talk about Grease Pencil and the dopesheet. We discussed keyframes shaped as boxes for grease pencil frames (potentially called Cels, see https://en.wikipedia.org/wiki/Cel). At the end of the week, I began work on the layer tree UI.

  • 8d0b10bbc7 Fix: GP brush stroke operator name and description
  • fa0fe6f55e Refactor: Pass deformed positions to curve selection
  • b29ba95cae GPv3: Add "(De)select All" operator and keymap
  • 7f4f771442 GPv3: Add "Select Box" operator
  • b550d0be23 Cleanup: Move anim_filter.c to C++
  • 26bad3b187 Curves: Add separate start and end amounts to Select Ends operator

June 12 - June 16 (week 19)

While I did attended the Annecy Festival this week, I also spent some of the time working on Grease Pencil. I reviewed code from other contributors and also worked on the layer tree UI.

Work-in-progress layer tree UI

June 19 - June 23 (week 20)

This week I worked mainly on the layer tree UI, an initial undo system for grease pencil edit mode and some core API changes.

Grease Pencil Layer Tree UI Progress.png

Commits:

Pull requests:

  • PR #109123 WIP: GPv3: Add initial undo system
  • PR #109251 Refactor: Convert several animation editor files to C++
  • PR #109293 Curves: Mask function for end points

I also reviewed several other PRs related to the Grease Pencil 3.0 project.

June 26 - June 30 (week 21)

I started this week by working more on the layer tree UI. I added support for showing groups, adding new groups and renaming groups. The visibility of layers and the lock state is now also inherited from the parent groups.

Layer Groups.png

Finally at the end of the week I participated in the Animation Workshop and worked on a prototype for a ghosting system. I wrote a devtalk thread with all the information: Ghosting System for Animation

Ghosting System Prototype.png

Commits:

  • 497f9a6941 GPv3: Add operator to reorder the active layer
  • 0a693165c8 Refactor: Move GreasePencilDrawing functionality
  • 5dd29c9a05 Fix: Uses of foreach_editable_drawing callbacks
  • 2418252ea7 Refactor: Move stroke_cache to gpencil runtime
  • 9f05936212 GPv3: Change name_plural to "grease_pencils_v3"
  • b69bba25ad GPv3: Add python endpoint to get/set active layer
  • 3d4cdd6b88 Fix: Typo in grease_pencil.layer_add description
  • 34d65eff1b Fix: Memory leak in grease_pencil.layer_reorder
  • b61316c7ad GPv3: Add operator to add new layer group
  • 5967cb53e9 GPv3: Make visibility and lock state inheritable
  • fee9801955 GPv3: Add caching of layer groups
  • bf4e9ffbd9 GPv3: Add rename function for layer groups
  • 5a9db0dd4c GPv3: Add initial layer group python API access
  • 4bb600ef95 GPv3: Add functions to find layer groups by name
  • 2f6d6d84d6 Fix: GPv3: Memory leak in reorder layer operator
  • eb856f6fbb GPv3: Build group hierarchy for layer tree UI
  • fdfc09502a GPv3: Improve redrawing for drawing operator
  • 6bec3bca09 GPv3: Remove dead code in drawing operator

July 03 - July 07 (week 22)

This week I mostly worked on internal Grease Pencil API things. I added functions to add frames with a duration as well as implicit holds (frames that are held until the next frame starts). I committed the circle select operator which means that all except one of the selection operators are implemented. Work on the drawing operator is also happening. This week I worked on getting the paint mode fully set up, make sure tool settings and brushes are working, and getting the cursor to show up. Finally, I helped Amélie with the eraser operator. Work on the drawing operator and the eraser will continue next week.

July 10 - July 14 (week 23)

This week I worked on a lot of smaller tasks. I also helped Amélie with some of her tasks every now and then. The initial dopsheet support (just for viewing channels and keyframes) is now in main. I also committed some of the changes in the drawing tool branch to main, so that they could be used for the eraser. I investigated an issue where copying a grease pencil data-block would lead to dangling pointers. I was able to fix the issue, but it required a change in the DNA part. This means that files saved before this commit are broken (if they had a grease pencil 3 object). Since GP 3 is considered experimental, no extra work on versioning this change was done.

July 17 - July 21 (week 24)

This week I mostly worked on the drawing tool and related areas like the UI. It's almost ready for a first round of testing now. Other than that I worked on a bunch of related tasks to the drawing. Specifically a "simplify" operator that removes points from a stroke without changing the visual appearance (within a threshold). I made sure that this function would also consider the thickness of the points (and could potentially even consider more, like the opacity or the vertex color!).

  • ba1795ec81 GPv3: Add tagging drawing for topology change
  • 2e3813f02c IndexMask: Add unoptimized from_union function
  • 93855a5efd IndexMask: Add tests for IndexMask::from_union
  • 46d60aacd8 Array Utils: Add find_all_ranges function
  • 71837fcb04 GPv3: Add get_editable_drawing_at function
  • 7cd5e25743 GPv3: Stroke Simplify operator
  • 8dd0faec54 GPv3: Refactor: ramer_douglas_peucker_simplify

July 24 - July 28 (week 25)

This week I began working on the modifier support for Grease Pencil 3. The initial step was committed and work on porting the old modifiers can begin soon. One step that is remaining is a common way to handle the filtering. I will continue working on this next week.

  • 5846b9164a GeometrySet: Add new GreasePencilComponent
  • d6aa9906fd Modifiers: Add idname field to ModifierTypeInfo
  • 610834540a GPv3: Return correct mode in BKE_paintmode_get_active_from_context
  • 8acd3dfb8e Anim: Cleanup: Move CfraElem struct to editors
  • 20b1077097 GPv3: Initial modifier support
  • 187545109a Cleanup: GPv3 drawings API

July 31 - August 04 (week 26)

After a week of feedback from the community on the drawing tool, I rewrote a majority of the code to address the issues this week. This is nearly done at the beginning of next week, another round of testing can start. I also worked on some core changes like adding a user count to drawings so we can instance a drawing on multiple keyframes. This is already supported internally now and just needs to be exposed by an operator.

  • 8df5968603 GPv3: Add remove_frame function to layers
  • de8ce4e34b GPv3: Add user count to drawings
  • 162fc23887 GPv3: Use add_new and remove_contained in core
  • b2f61b5c8a GPv3: Replace int with FramesMapKey
  • 331969159e Fix: Unreported memory leak
  • 873453005d Fix: GPv3 not rendering when origin is out of view
  • 270a229728 Fix: GPv3: Crash on undo when changing frames map
  • 110ea98ea2 GPv3: Fix missing tag in frames map
  • 13e9f553b9 Cleanup: GPv3: Use references in editor functions

August 07 - August 11 (week 27)

At the beginning of this week I did some more work on the drawing tool. I worked on making the stroke ends a bit better and fixed some issues. It's now in another round of testing. I then began working on a pull request to add vertex group support for Curves and CurvesGeometry PR #106944. This is one of the remaining blockers for modifier filters to work properly. Finally I worked on the outliner support for GPv3. The PR is almost ready.

Grease Pencil 3 Outliner Screenshot.png

GPv3 commits:

  • 827a71fe7e GPv3: Refactor: replace remove_frame_at function
  • 9e172b9e2e Cleanup: GPv3: Use int64_t for indices
  • 4f66031714 GPv3: Fix TreeNode::parent_group() for root group
  • 7e594b5d96 GPv3: Allow buttons for child nodes to be inactive
  • d14289c46a GPv3: Fix: Assert hit when exiting paint mode

Other commits:

  • 5eef5b0d61 Fix #110447: Curves random selection is reversed
  • 101abc6f6c Sim Nodes: Don't delete parent bake directory

August 14 - August 18 (week 28)

At the beginning of the week I committed the initial outliner support. I then spent some time refactoring parts of the core structure, namely the use of TreeNode class. Core functions that both work on layers and layer groups should use this class instead (e.g. rename_layer should really be rename_node). I then started to work on the ghosting system (e.g. onion skinning) again. I will continue that work after my holiday break in September.

  • 310ccbdc33 GPv3: Initial outliner support
  • ba574097b8 GPv3: Python: Rename groups to layer_groups
  • 2661747138 Cleanup: GPv3: Move inline Drawing methods
  • 969de5135a GPv3: Re-evaluate on frame change
  • b14a0ee57e Cleanup: GPv3: Refactor usage of TreeNode
  • 5aacbf6c81 Fix: GPv3: Crash because of missing null check
  • 0bc755face Fix #109403: GP doesn't render selection outline
  • 725f1dbf2d Revert: GPv3: DNA rename of name
  • d06a6105a7 Fix: GPv3: TreeNode::is_locked() function
  • 24082ceecc Cleanup: GPv3: Constructors and destructors

August 21 - August 25 (week 29)

On vacation.

August 28 - September 01 (week 30)

On vacation.

September 04 - September 08 (week 31)

On vacation.

September 11 - September 15 (week 32)

I started the week by finishing the review of a lot of PRs for the grease pencil dopesheet. Almost all operators have been ported to GPv3 now. At the end of the week I began looking into Geometry Nodes support. There might be a need from the studio for it.

With the Geometry Nodes team we decided on a design for an initial implementation. I'll post a write-up on devtalk next week.

Committed:

  • b66c0676b4 GPv3: Move dopesheet channels
  • 5ed35e5665 Cleanup: Anim: Replace use of T_AUTOMERGE
  • c0850237a1 Fix: "use_duplicated_keyframes" not found
  • 97d2dbb24e Fix #112068: Crash when loading converted curves

Reviewed:

September 18 - September 22 (week 33)

I spent most of this week working on the geometry nodes integration for grease pencil. I wrote a post on devtalk about it: https://devtalk.blender.org/t/grease-pencil-integration-into-geometry-nodes/31220/15 Progress has been good and there is a WIP pull request: PR #112535

Here is a quick demo of the "Set Position node":


Reviewed & committed:

  • 8eb2d193c5 GPv3: Re-evaluate object after deleting keyframes
  • 7e944b1b2c GPv3: Add statistics information

September 25 - September 29 (week 34)