diff --git a/src/panels.py b/src/panels.py index 6720374..0b0595d 100644 --- a/src/panels.py +++ b/src/panels.py @@ -140,7 +140,9 @@ class SequenceImportSettings(bpy.types.PropertyGroup): fileFormat: bpy.props.EnumProperty( items=[('obj', 'OBJ', 'Wavefront OBJ'), ('stl', 'STL', 'STereoLithography'), - ('ply', 'PLY', 'Stanford PLY')], + ('ply', 'PLY', 'Stanford PLY'), + ('wrl', 'WRL', 'WRL file'), + ], name='File Format', default='obj') dirPathIsRelative: bpy.props.BoolProperty( @@ -160,7 +162,7 @@ class ImportSequence(bpy.types.Operator, ImportHelper): sequenceSettings: bpy.props.PointerProperty(type=SequenceImportSettings) # for now, we'll just show any file type that Stop Motion OBJ supports - filter_glob: bpy.props.StringProperty(default="*.stl;*.obj;*.mtl;*.ply") + filter_glob: bpy.props.StringProperty(default="*.stl;*.obj;*.mtl;*.ply;*.wrl") directory: bpy.props.StringProperty(subtype='DIR_PATH') @@ -279,6 +281,8 @@ def draw(self, context): layout.row().prop(op.importSettings, "stl_use_facet_normal") elif op.sequenceSettings.fileFormat == 'ply': layout.label(text="No .ply settings") + elif op.sequenceSettings.fileFormat == 'wrl': + layout.label(text="No .wrl settings") class SMO_PT_TransformSettingsPanel(bpy.types.Panel): diff --git a/src/stop_motion_obj.py b/src/stop_motion_obj.py index 0817617..261158a 100644 --- a/src/stop_motion_obj.py +++ b/src/stop_motion_obj.py @@ -162,6 +162,8 @@ def fileExtensionFromType(_type): return 'stl' elif(_type == 'ply'): return 'ply' + elif(_type == 'wrl'): + return 'wrl' return '' @@ -236,6 +238,8 @@ def load(self, fileType, filePath): self.loadSTL(filePath) elif fileType == 'ply': self.loadPLY(filePath) + elif fileType == 'wrl': + self.loadWRL(filePath) def loadOBJ(self, filePath): # call the obj load function with all the correct parameters @@ -282,6 +286,14 @@ def loadPLY(self, filePath): # call the ply load function with all the correct parameters bpy.ops.import_mesh.ply(filepath=filePath) + def loadWRL(self, filePath): + # call the WRL load function with all the correct parameters + bpy.ops.import_scene.x3d(filepath=filePath) + for obj in bpy.context.selected_objects: + if obj.type != 'MESH': + print('deleting ', obj) + bpy.data.objects.remove(obj) + class MeshNameProp(bpy.types.PropertyGroup): key: bpy.props.StringProperty() @@ -323,7 +335,9 @@ class MeshSequenceSettings(bpy.types.PropertyGroup): fileFormat: bpy.props.EnumProperty( items=[('obj', 'OBJ', 'Wavefront OBJ'), ('stl', 'STL', 'STereoLithography'), - ('ply', 'PLY', 'Stanford PLY')], + ('ply', 'PLY', 'Stanford PLY'), + ('wrl', 'WRL', 'WRL file'), + ], name='File Format', default='obj')