Page MenuHome

T90372: Assets: When dropping material use active material slot.
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Jul 28 2021, 3:15 PM.

Details

Summary

Currently when dropping an asset the first material slot is always updated.
This patch changes that logic to update the active material slot.

In future the behavior will be updated to use the material slot of the face under the cursor.
That requires better feedback tot he user.

Diff Detail

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

Event Timeline

Jeroen Bakker (jbakker) retitled this revision from Assets: When dropping material use active material slot. to Fix T90372: Assets: When dropping material use active material slot..Aug 2 2021, 10:58 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
Julian Eisel (Severin) accepted this revision.EditedAug 2 2021, 4:04 PM

BKE_object_material_assign() handles the case of object-data material assignment I believe, so this should be fine.

But can we avoid using the term "Fix" for such commits? It's not really a bug fix just regular development :) I think "Addresses Txxxxx" in the commit description works.

This revision is now accepted and ready to land.Aug 2 2021, 4:04 PM
Jeroen Bakker (jbakker) retitled this revision from Fix T90372: Assets: When dropping material use active material slot. to Addresses T90372: Assets: When dropping material use active material slot..
Jeroen Bakker (jbakker) retitled this revision from Addresses T90372: Assets: When dropping material use active material slot. to T90372: Assets: When dropping material use active material slot..

Can I ask here?
As I see it would work only if I drop asset material on object in Object mode.
Let's imagine behavior for Edit mode:

  1. without selection: I drop asset material on face, it should replace material slot under the cursor (as you mention in TODO).
  2. with selection: I drop asset material on selected faces or even in free space or other unselected element, it should create new material slot for selection and assign dropped material.

And do not forget about multiple objects.
If I select multiple objects in Object mode and drop material - how it should behave? Replace material slot under the cursor for one object or replace material with the same name for all objects?

And for multiple objects in Edit mode.
As I explain in 2. + it should create and assign material for multiple objects.

Thanks.

@Eugene Du (APEC) I would say that if a user has already a selection and you want to assign a material to that selection dragging and dropping is already a waste. It would then be easier if there is an operator "assign to selection." The time saver of dragging and dropping is that you can do it without changing selection. An assign to selection could also work in edit mode. Although not a fan of creating new material slot or different behaviors based on selection I do see for editing this could be useful.

The current system is better prepared for material templates (eg assigning base materials that can will be modified by the user afterwards.)
For edit mode there are more stuff to think of. basically every time you assign a material to a selection a copy is created of the material. This is something that you don't want when in edit mode. If the object has already that material the system should be able to reuse that material. This is not easy to do in the current system as assets are applied and references to the original asset are removed. And what should happen if the user in the mean time has altered the material. Is it then still the same asset?

I will get some feedback from others and see what workflow should be more dominant.

Eugene Du (APEC) added a comment.EditedAug 3 2021, 9:42 AM

"assign to selection."

I'm not sure if it would be better than drag-n-drop.
How it would be implemented? RMB on material in Asset Browser and select option "Assign to selection"? or there will be the button somewhere in the Asset Browser UI? All two variants to click and to search for button will take the same time or even more than just drag-n-drop

For edit mode there are more stuff to think of. basically every time you assign a material to a selection a copy is created of the material. This is something that you don't want when in edit mode. If the object has already that material the system should be able to reuse that material. This is not easy to do in the current system as assets are applied and references to the original asset are removed. And what should happen if the user in the mean time has altered the material. Is it then still the same asset?

Can it firstly check for same names when we drop material, if names matched then select other faces with same material, reassign and select original selection.
About "has altered the material", if he change material name then yes, it's a new material and, when assigning, it should create new slot

I will get some feedback from others and see what workflow should be more dominant.

if you create topic on devtalk then definitely there will be many reviews and suggestions about it.