Page MenuHome

Fix: paint slot material assignment issues
ClosedPublic

Authored by Ethan Hall (Ethan1080) on May 3 2022, 1:32 PM.

Details

Summary

There are two problems when adding a paint slot to an object without
an existing material.
First, the invoke method creates a material on the object. This
modifies the object even if the operation is not executed.
Second, the fill color defaults to black when there is no existing
material (even when adding a normal, bump, or displacement layer.)

This patch moves the material creation to the exec method.
When no material exists on the object, a default Principled BSDF is
referenced for default colors in the invoke method.

Diff Detail

Repository
rB Blender
Branch
paint_slot_mat_assignment (branched from master)
Build Status
Buildable 22028
Build 22028: arc lint + arc unit

Event Timeline

Ethan Hall (Ethan1080) requested review of this revision.May 3 2022, 1:32 PM
Ethan Hall (Ethan1080) created this revision.

The code looks better, thanks for the change.
I added a few inline comments, but I'm accepting since they're pretty simple and shouldn't require further iteration from me.

source/blender/editors/sculpt_paint/paint_image_proj.c
6738–6741

I have some nitpicks about this comment:

  • [in] and [out] aren't used generally, they shouldn't be so necessary, the r_ prefix serves the same purpose`.
  • The phrase for r_color doesn't add anything that isn't obvious from the function and variable names. I'd like to avoid adding such "boilerplate" comments, they just take up space IMO.
  • The # before NULL doesn't seem necessary, it's just a type or name that needs to be referenced, it's just zero.
6743

It's easier to read the diff if this function isn't moved (in other words keeping it below proj_paint_image_create.

This revision is now accepted and ready to land.May 3 2022, 3:45 PM
  • Rebase
  • Tweak comments
Ethan Hall (Ethan1080) marked an inline comment as done.May 9 2022, 4:30 PM
  • Remove unused method
  • Move method to make diff easier to read
Ethan Hall (Ethan1080) marked an inline comment as done.May 9 2022, 5:29 PM