From ae1b08b8185b6fabc8ea942959fd6431c45a4e9c Mon Sep 17 00:00:00 2001 From: aleichter Date: Fri, 29 Dec 2023 21:14:05 -0500 Subject: [PATCH 1/2] Added functionality to teat holding the shift key and selecting From Facemap as an additive select --- facemap_select.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/facemap_select.py b/facemap_select.py index d7baf3a..98d2bbd 100644 --- a/facemap_select.py +++ b/facemap_select.py @@ -56,7 +56,8 @@ def poll(self, context): ) def execute(self, context): - bpy.ops.mesh.select_all(action="DESELECT") + if not self.__shift: + bpy.ops.mesh.select_all(action="DESELECT") attribute_name = context.active_object.data.attributes.active.name bpy.ops.object.editmode_toggle() for polygon, facemap_attribute in zip( @@ -66,7 +67,10 @@ def execute(self, context): polygon.select = facemap_attribute.value bpy.ops.object.editmode_toggle() return {"FINISHED"} - + + def invoke(self, context, event): + self.__shift = event.shift + return self.execute(context) class FacemapCreate(bpy.types.Operator): bl_idname = "mesh.facemap_create" From b320ed5cb875c81a97de02c8b8154d79b2250c4f Mon Sep 17 00:00:00 2001 From: varkenvarken Date: Sat, 30 Dec 2023 14:12:19 +0100 Subject: [PATCH 2/2] merged PR from aleichter --- facemap_select.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/facemap_select.py b/facemap_select.py index 98d2bbd..72266ef 100644 --- a/facemap_select.py +++ b/facemap_select.py @@ -26,8 +26,8 @@ bl_info = { "name": "FacemapSelect", - "author": "Michel Anders (varkenvarken)", - "version": (0, 0, 20231014152157), + "author": "Michel Anders (varkenvarken) with contribution from Andrew Leichter (aleichter)", + "version": (0, 0, 20231230140402), "blender": (4, 0, 0), "location": "Edit mode 3d-view, Select- -> From facemap | Create facemap", "description": "Select faces based on the active boolean facemap or create a new facemap", @@ -39,10 +39,13 @@ import bpy + class FacemapSelect(bpy.types.Operator): bl_idname = "mesh.facemap_select" bl_label = "FacemapSelect" - bl_description = "Select faces based on active facemap" + bl_description = ( + "Select faces based on active facemap (+ Shift add to current selection)" + ) bl_options = {"REGISTER", "UNDO"} @classmethod @@ -64,18 +67,23 @@ def execute(self, context): context.active_object.data.polygons, context.active_object.data.attributes[attribute_name].data, ): - polygon.select = facemap_attribute.value + polygon.select |= ( + facemap_attribute.value + ) # keeps polygons selected that already were bpy.ops.object.editmode_toggle() return {"FINISHED"} - + def invoke(self, context, event): self.__shift = event.shift return self.execute(context) + class FacemapCreate(bpy.types.Operator): bl_idname = "mesh.facemap_create" bl_label = "FacemapCreate" - bl_description = "Create a new boolean face map and set value according to current selection" + bl_description = ( + "Create a new boolean face map and set value according to current selection" + ) bl_options = {"REGISTER", "UNDO"} @classmethod