Skip to content

Commit f1d6782

Browse files
committed
add refresh button
1 parent df91f27 commit f1d6782

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
SIMLOADER_OT_remove_split_norm,
4242
SIMLOADER_OT_disable_selected,
4343
SIMLOADER_OT_enable_selected,
44+
SIMLOADER_OT_refresh_seq,
4445
]
4546

4647

simloader/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .operators import SIMLOADER_OT_load, SIMLOADER_OT_edit, SIMLOADER_OT_resetpt, SIMLOADER_OT_resetmesh, SIMLOADER_OT_resetins,SIMLOADER_OT_set_as_split_norm,SIMLOADER_OT_remove_split_norm,SIMLOADER_OT_disable_selected,SIMLOADER_OT_enable_selected
1+
from .operators import SIMLOADER_OT_load, SIMLOADER_OT_edit, SIMLOADER_OT_resetpt, SIMLOADER_OT_resetmesh, SIMLOADER_OT_resetins,SIMLOADER_OT_set_as_split_norm,SIMLOADER_OT_remove_split_norm,SIMLOADER_OT_disable_selected,SIMLOADER_OT_enable_selected,SIMLOADER_OT_refresh_seq
22
from .properties import SIMLOADER_scene_property, SIMLOADER_obj_property,SIMLOADER_mesh_property
33
from .panels import SIMLOADER_UL_Obj_List, SIMLOADER_List_Panel, SIMLOADER_Settings, SIMLOADER_Import, SIMLOADER_Templates, SIMLOADER_UL_Att_List, draw_template
44
from .messanger import subscribe_to_selected, unsubscribe_to_selected
@@ -60,4 +60,5 @@ def SIMLOADER_initilize(scene):
6060
"SIMLOADER_OT_remove_split_norm",
6161
"SIMLOADER_OT_disable_selected",
6262
"SIMLOADER_OT_enable_selected",
63+
"SIMLOADER_OT_refresh_seq",
6364
]

simloader/operators.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,4 +244,30 @@ def execute(self, context):
244244
for obj in bpy.context.selected_objects:
245245
if obj.SIMLOADER.init and not obj.SIMLOADER.enabled:
246246
obj.SIMLOADER.enabled = True
247+
return {"FINISHED"}
248+
249+
250+
251+
class SIMLOADER_OT_refresh_seq(bpy.types.Operator):
252+
'''
253+
This operator refresh the sequence
254+
'''
255+
bl_label = "Refresh Sequence"
256+
bl_idname = "simloader.refresh"
257+
def execute(self, context):
258+
scene = context.scene
259+
obj = bpy.data.objects[scene.SIMLOADER.selected_obj_num]
260+
261+
262+
fs = obj.SIMLOADER.pattern
263+
if obj.SIMLOADER.use_relative:
264+
fs = bpy.path.abspath(fs)
265+
fs = fileseq.findSequenceOnDisk(fs)
266+
fs = fileseq.findSequenceOnDisk(fs.dirname()+ fs.basename() + "@" + fs.extension())
267+
fs = str(fs)
268+
if obj.SIMLOADER.use_relative:
269+
fs = bpy.path.relpath(fs)
270+
obj.SIMLOADER.pattern = fs
271+
272+
247273
return {"FINISHED"}

simloader/panels.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ def draw(self, context):
6565
sim_loader = context.scene.SIMLOADER
6666
row = layout.row()
6767
row.template_list("SIMLOADER_UL_Obj_List", "", bpy.data, "objects", sim_loader, "selected_obj_num", rows=2)
68-
layout.operator("simloader.enableselected")
69-
layout.operator("simloader.disableselected")
70-
layout.operator("sequence.edit")
68+
row = layout.row()
69+
row.operator("simloader.enableselected")
70+
row.operator("simloader.disableselected")
71+
row = layout.row()
72+
row.operator("sequence.edit")
73+
row.operator("simloader.refresh")
7174

7275

7376
class SIMLOADER_Settings(bpy.types.Panel):

0 commit comments

Comments
 (0)