Fix: Material Library VX add-on cannot apply library materials to selected object

Fix https://developer.blender.org/T90483, https://developer.blender.org/T89680

Reviewed By: mont29, dfelinto, campbellbarton

Maniphest Tasks: T89740, T90483, T89680

Differential Revision: https://developer.blender.org/D12214
This commit is contained in:
Iyad Ahmed 2021-08-31 10:12:52 +02:00 committed by Bastien Montagne
parent 36edc11a43
commit 36671a4e21
Notes: blender-bot 2023-02-14 18:34:45 +01:00
Referenced by issue #90483, Materials Library VX error when Preview
Referenced by issue #89740, Materials Library throws error when applying a material
Referenced by issue #89680, Material Library VX add-on cannot apply library materials to selected object
1 changed files with 2 additions and 2 deletions

View File

@ -489,7 +489,7 @@ if mat:
return "WARNING", "Select a material"
def get_material(self, name, link=False):
with bpy.data.libraries.load(self.current_library.path, link, False) as (data_from, data_to):
with bpy.data.libraries.load(self.current_library.path, link=link, relative=False) as (data_from, data_to):
data_to.materials = [name]
if link:
print(name + " linked.")
@ -523,7 +523,7 @@ if mat:
return "INFO", "Please select an object"
if dummy == context.object and not preview:
if (len(objects)==1 and dummy.select):
if (len(objects)==1 and dummy.select_get()):
return "ERROR", "Apply is disabled for the Material Preview Object"
try:
last = context.scene.objects[self.last_selected]