Skip to content

Commit

Permalink
operator now only apply to bool attrs in the face domain
Browse files Browse the repository at this point in the history
  • Loading branch information
varkenvarken committed Nov 7, 2024
1 parent 660c08e commit 295ff45
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions facemap_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
bl_info = {
"name": "FacemapSelect",
"author": "Michel Anders (varkenvarken) with contribution from Andrew Leichter (aleichter) and Tyo79",
"version": (0, 0, 20241107130236),
"version": (0, 0, 20241107132244),
"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",
Expand Down Expand Up @@ -113,6 +113,11 @@ class FacemapAssign(bpy.types.Operator):

param: bpy.props.StringProperty()

@classmethod
def poll(self, context):
fm = context.object.data.attributes.active
return fm is not None and fm.domain == "FACE" and fm.data_type == "BOOLEAN"

def execute(self, context):
obj = context.object
facemap = context.object.data.attributes.active
Expand Down Expand Up @@ -140,6 +145,11 @@ class FacemapSelections(bpy.types.Operator):

param: bpy.props.StringProperty()

@classmethod
def poll(self, context):
fm = context.object.data.attributes.active
return fm is not None and fm.domain == "FACE" and fm.data_type == "BOOLEAN"

def execute(self, context):
obj = context.object

Expand Down Expand Up @@ -172,8 +182,12 @@ class FMS_OT_facemap_delete(bpy.types.Operator):
bl_description = "Delete Active face map "
bl_options = {"REGISTER", "UNDO"}

def execute(self, context):
@classmethod
def poll(self, context):
fm = context.object.data.attributes.active
return fm is not None and fm.domain == "FACE" and fm.data_type == "BOOLEAN"

def execute(self, context):
bpy.ops.geometry.attribute_remove()
return {"FINISHED"}

Expand Down Expand Up @@ -287,6 +301,17 @@ def menu_func(self, context):
]


classes = [
FacemapSelect,
FacemapCreate,
FMS_OT_facemap_delete,
FacemapAssign,
FacemapSelections,
MESH_UL_fmaps,
DATA_PT_face_maps,
]


def register():
for cls in classes:
bpy.utils.register_class(cls)
Expand Down

0 comments on commit 295ff45

Please sign in to comment.