Page MenuHome

Asset: Dropping Material assets on material slot under mouse cursor.
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Aug 11 2021, 9:20 AM.

Details

Summary

This patch allows dropping material assets from material slot under the mouse
cursor. Before this change the material slot had to be hand-picked from the
properties panel.

For consistency it is chosen to do this in any shading mode as the tooltip shows
what is exactly going to happen during release.

The feature also works for other object types than Meshes as it uses the drawn surface on the
GPU to detect the material slots. Performance of this patch has been tested with AMD GCN3.0
cards and are very responsive.

Video demonstrating material slot selection.

Diff Detail

Repository
rB Blender

Event Timeline

  • Silenced clang-tidy warnings.
  • Fixed crash when object has no uvs.

One nice thing to note, this implementation uses OpenGL picking, so it also works for curves or other object types with "no real geometry". Using ray-casting this wouldn't work.

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Aug 16 2021, 4:36 PM
  • Merge branch 'master' into temp-T90576-asset-browser-drop-on-material-slot
  • Remove incorrect assert statement.
  • Moved material slot support detection to BKE_object.
  • Add support for material slot selection of hair.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Aug 17 2021, 9:01 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Aug 17 2021, 9:43 AM
Jeroen Bakker (jbakker) requested review of this revision.Aug 17 2021, 9:48 AM

Since this mostly touches the draw manager, there isn't much I can contribute in terms of code review, although things seem reasonable.
As a feature I think this is great to have, although I'm wondering if it should be optional in some way. Best to first let people test this in practice, then we can decide to make things optional still.

Clément Foucault (fclem) requested changes to this revision.Aug 31 2021, 9:39 AM

Selection as a whole is getting a bit too much inside the draw manager but it's a lesser evil than having a dedicated selection engine for overlays.
Maybe one day we will just have this dedicated engine with simpler drawing for overlays but I doubt.

source/blender/draw/intern/draw_manager_data.c
801 ↗(On Diff #40767)

Why are you using a separated argument with a new macro instead of using DRW_select_load_id like many other areas do?

Also I'm pretty sure this + should be an | although it may do the same thing for most values.

This revision now requires changes to proceed.Aug 31 2021, 9:39 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Reverted DRW_shgroup_call_with_subselection.
Jeroen Bakker (jbakker) marked an inline comment as done.Aug 31 2021, 10:21 AM
Jeroen Bakker (jbakker) added inline comments.
source/blender/draw/intern/draw_manager_data.c
801 ↗(On Diff #40767)

I haven't done with selection since the introduction of the selection engine. Will test if DRW_select_load_id leads to the same behavior.

This revision is now accepted and ready to land.Sep 7 2021, 6:47 PM