diff --git a/src/mpfb/services/objectservice.py b/src/mpfb/services/objectservice.py index 0c110891..66835bfa 100644 --- a/src/mpfb/services/objectservice.py +++ b/src/mpfb/services/objectservice.py @@ -90,6 +90,11 @@ def activate_blender_object(object_to_make_active, *, context=None, deselect_all context = context or bpy.context context.view_layer.objects.active = object_to_make_active + @staticmethod + def select_object(obj): + """Selects an object an makes it active.""" + bpy.context.view_layer.objects.active = obj + @staticmethod def deselect_and_deactivate_all(): """Make sure no object is selected nor active.""" diff --git a/src/mpfb/ui/assetlibrary/operators/unloadlibraryclothes.py b/src/mpfb/ui/assetlibrary/operators/unloadlibraryclothes.py index 74949ad4..fb9913bf 100644 --- a/src/mpfb/ui/assetlibrary/operators/unloadlibraryclothes.py +++ b/src/mpfb/ui/assetlibrary/operators/unloadlibraryclothes.py @@ -54,9 +54,13 @@ def execute(self, context): if not asset: self.report({'ERROR'}, "Could not find asset?") return {'FINISHED'} + + parent = basemesh.parent HumanService.unload_mhclo_asset(basemesh, asset) + ObjectService.select_object(parent) + #_LOG.debug("Will call add_mhclo_asset: (asset_type, material_type)", (self.object_type, self.material_type)) #HumanService.add_mhclo_asset(self.filepath, basemesh, asset_type=self.object_type, subdiv_levels=subdiv_levels, material_type=self.material_type)