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
8 changes: 6 additions & 2 deletions src/panels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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')

Expand Down Expand Up @@ -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):
Expand Down
16 changes: 15 additions & 1 deletion src/stop_motion_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def fileExtensionFromType(_type):
return 'stl'
elif(_type == 'ply'):
return 'ply'
elif(_type == 'wrl'):
return 'wrl'
return ''


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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')

Expand Down