Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions import_3dm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ class Import3dm(Operator, ImportHelper):
default="ALL",
) # type: ignore

@classmethod
def poll(cls, context: bpy.types.Context):
return context.mode == "OBJECT"

def execute(self, context : bpy.types.Context):
options : Dict[str, Any] = {
"filepath":self.filepath,
Expand Down
4 changes: 4 additions & 0 deletions import_3dm/read3dm.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,12 @@ def read_3dm(
if bpy.app.version[0] < 4:
bpy.ops.object.shade_smooth({'selected_editable_objects': toplayer.all_objects})
else:
# set the active object on the viewlayer to none as that is checked by shade smooth
active_object = bpy.context.view_layer.objects.active
bpy.context.view_layer.objects.active = None
with context.temp_override(selected_editable_objects=toplayer.all_objects):
bpy.ops.object.shade_smooth()
bpy.context.view_layer.objects.active = active_object

converters.cleanup()

Expand Down