Page MenuHome

GPencil: New option to Merge All layers in active one
ClosedPublic

Authored by Antonio Vazquez (antoniov) on Oct 31 2021, 6:34 PM.

Details

Summary

This operator allows to merge all layers in the active one.

Diff Detail

Repository
rB Blender

Event Timeline

Antonio Vazquez (antoniov) requested review of this revision.Oct 31 2021, 6:34 PM
Antonio Vazquez (antoniov) created this revision.
  • GPencil: Change tooltip

Testing patch, there is one whitespace warning:

$ git apply D13054.diff
D13054.diff:229: trailing whitespace.

warning: 1 line adds whitespace errors.

Stroke order gets messed up when flattening.
Expected: flattened image would look the same as layered, this is the result you would get by merging one by one from top down
Current behavior: see video

When used flatten from bottom layer it produces desired result

@Aleš Jelovčan (frogstomp) I will take a look... I thought I had tested all situations.

It seems that the layer flattening result are different depending on the current active layer. The result should always be the same regardless the active layer

  • Fix error in stroke order
  • Apply clang format

@Antonio Vazquez (antoniov) tested, the whitespace issue is gone.

Issues:

flattening with existing modifiers still produces unwanted results. Please find attached debug file, you can read states of te GP objects by name.

Other observations:

  • how should flattening affect locked layers? Idea of locking is to prevent any alteration. Flattening overrides this.

The flatten or merge is not remaping any modifier and this is why you get different result. I'm not sure we can/must fix this automatically. If we do automatically, it's not sure the result is the right one because maybe you have a setup dificult to fix it.

About lock... actually, merge down is not checking the lock either. @Matias Mendiola (mendio) do you think we must check the lock or not?

@Antonio Vazquez (antoniov) I suppose underlying mechanic is different here, but the example of auto-applying modifiers is seen in bake grease pencil animation.

Actually, I get it now.. the different results was shown because modifiers were set to specific layers which did no longer exist, or because others were before excluded, but are now in the scope of this modifier. This is probably something user should clean up on their part. Maybe it is best to display a notice, to inform that modifiers might cause unwanted results:

other than that, I could not find any more issues so far, well done

The operator works better now.
Flatten layers is a destructive operator, so it's up to the user to set up Modifiers accordingly and IMO all layers should be flattened regardless is locked or not (All other softwares that have similar operators behave this way).

Some things are still missing, the final result layer should use all the default Layer settings (right now is using the active layer setting):

  • Blend: Regular
  • Opacity: 1.000
  • Use light: On
  • Visible: On
  • Lock: Off
  • Onion Skinning: On
  • Tint Color: Black / Factor 0.000
  • Stroke Thickness: 0.000

Finally, all the layer transforms (Loc, Rot, Scale) should be apllied before flatten to mantain final layer appearance

  • Apply Line Thickness change to layers when flatten.
  • Fix wrong thickness when use Merge Down operator.
  • Apply layer opacity in Flatten
  • Improve default values and fix bug with Thickness acumulation

I'm not so sure about the name Flatten.
Even in your description you had to explain what it means.

"This operator allows to merge all layers in the active one."

Why not call it "Merge all" or "Merge all Layers" or if you don't like it maybe "Collapse" or "Collapse Layers/all Layers"?

  • Fix Fill opacity and Show Icon
  • Merge branch 'master' into temp-gp-merge-layer
  • Apply layer transformation
Antonio Vazquez (antoniov) retitled this revision from GPencil: New Flatten layer operator to GPencil: New option to Merge All layers in active one.Nov 4 2021, 1:06 PM
  • Change sin tooltips and names
This revision is now accepted and ready to land.Nov 4 2021, 7:29 PM