Skip to content

Commit 74b88e7

Browse files
remove custom script execution for loading other file types
1 parent d5bf9a9 commit 74b88e7

File tree

3 files changed

+10
-52
lines changed

3 files changed

+10
-52
lines changed

bseq/importer.py

Lines changed: 10 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -306,57 +306,19 @@ def update_obj(scene, depsgraph=None):
306306

307307
fs = fileseq.FileSequence(full_path)
308308

309-
if obj.BSEQ.use_advance and obj.BSEQ.script_name:
310-
script = bpy.data.texts[obj.BSEQ.script_name]
311-
show_message_box(f"Cannot run custom script {obj.BSEQ.script_name} using extension from Blender extensions. Use a custom build to enable. Removing script file..." + str(e), "INFO")
312-
obj.BSEQ.script_name = ""
313-
# try:
314-
# exec(script.as_string())
315-
# except Exception as e:
316-
# show_message_box(traceback.format_exc(), "running script: " + obj.BSEQ.script_name + " failed: " + str(e),
317-
# "ERROR")
318-
# continue
319-
320-
if 'process' in locals():
321-
user_process = locals()['process']
322-
try:
323-
user_process(fs, current_frame, obj.data)
324-
obj.BSEQ.current_file = "Controlled by user process"
325-
except Exception as e:
326-
show_message_box("Error when calling user process: " + traceback.format_exc(), icon="ERROR")
327-
del locals()['process']
328-
# this continue means if process exist, all the remaining code will be ignored, whethere or not error occurs
329-
continue
330-
331-
elif 'preprocess' in locals():
332-
user_preprocess = locals()['preprocess']
333-
try:
334-
meshio_mesh = user_preprocess(fs, current_frame)
335-
obj.BSEQ.current_file = "Controlled by user preprocess"
336-
except Exception as e:
337-
show_message_box("Error when calling user preprocess: " + traceback.format_exc(), icon="ERROR")
338-
# this continue means only if error occures, then goes to next bpy.object
339-
continue
340-
finally:
341-
del locals()['preprocess']
342-
343-
else:
344-
if obj.BSEQ.match_frames:
345-
fs_frames = fs.frameSet()
346-
if current_frame in fs_frames:
347-
filepath = fs[fs_frames.index(current_frame)]
348-
filepath = os.path.normpath(filepath)
349-
meshio_mesh = load_meshio_from_path(fs, filepath, obj)
350-
else:
351-
meshio_mesh = meshio.Mesh([], [])
352-
else:
353-
filepath = fs[current_frame % len(fs)]
309+
if obj.BSEQ.match_frames:
310+
fs_frames = fs.frameSet()
311+
if current_frame in fs_frames:
312+
filepath = fs[fs_frames.index(current_frame)]
354313
filepath = os.path.normpath(filepath)
355314
meshio_mesh = load_meshio_from_path(fs, filepath, obj)
315+
else:
316+
meshio_mesh = meshio.Mesh([], [])
317+
else:
318+
filepath = fs[current_frame % len(fs)]
319+
filepath = os.path.normpath(filepath)
320+
meshio_mesh = load_meshio_from_path(fs, filepath, obj)
356321

357-
if not isinstance(meshio_mesh, meshio.Mesh):
358-
show_message_box('function preprocess does not return meshio object', "ERROR")
359-
continue
360322
update_mesh(meshio_mesh, obj.data)
361323

362324
apply_transformation(meshio_mesh, obj, depsgraph)

bseq/panels.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ def draw(self, context):
112112
if not obj.BSEQ.init:
113113
return
114114

115-
col1.label(text='Script')
116-
col2.prop_search(obj.BSEQ, 'script_name', bpy.data, 'texts', text="")
117-
118115
# geometry nodes settings
119116
layout.label(text="Geometry Nodes (select sequence first)")
120117

bseq/properties.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ class BSEQ_obj_property(bpy.types.PropertyGroup):
121121
name="Activate/Deactivate",
122122
description="If deactivated, sequence won't be updated each frame")
123123
use_advance: bpy.props.BoolProperty(default=False)
124-
script_name: bpy.props.StringProperty(name="Script name")
125124
path: bpy.props.StringProperty(name="Path of sequence", subtype="DIR_PATH", options={'PATH_SUPPORTS_BLEND_RELATIVE' if bpy.app.version >= (4, 5, 0) else ''})
126125
pattern: bpy.props.StringProperty(name="Pattern of sequence")
127126
current_file: bpy.props.StringProperty(description="File of sequence that is currently loaded")

0 commit comments

Comments
 (0)