Skip to content

Commit

Permalink
Added is_candidate_object
Browse files Browse the repository at this point in the history
- Added `is_candidate_object` function that will check if the active
  object is a mesh type or not. Since the addon can only operate on a
  mesh, this is necessary

- If the active object is null, this will return False
  • Loading branch information
AldrinMathew committed Feb 19, 2022
1 parent a6c1422 commit 3e91384
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions stopmagic/functions/is_candidate_object.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from __future__ import annotations
import bpy


def is_candidate_object(context: bpy.types.Context | None) -> bool:
if context is None:
context = bpy.context
if context.view_layer.objects.active is None:
return False
else:
return context.view_layer.objects.active.type == "MESH"

0 comments on commit 3e91384

Please sign in to comment.