Skip to content

Commit 242acd2

Browse files
committed
rewrite edit
1 parent 2d98a27 commit 242acd2

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

bseq/callback.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ def update_selected_obj_num(self, context):
4848

4949

5050
def poll_material(self, material):
51-
return not material.is_grease_pencil
51+
return not material.is_grease_pencil
52+
53+
def poll_edit_obj(self, object):
54+
return object.BSEQ.init

bseq/importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def create_obj(fileseq, use_relaitve, transform_matrix=Matrix([[1, 0, 0, 0], [0,
165165
object.BSEQ.enabled = enabled
166166
object.matrix_world = transform_matrix
167167
driver = object.driver_add("BSEQ.frame")
168-
driver.driver.expression = 'fmod(frame, {})'.format(len(fileseq))
168+
driver.driver.expression = 'frame'
169169
if enabled:
170170
update_mesh(meshio_mesh, object.data)
171171
bpy.context.collection.objects.link(object)

bseq/messenger.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def selected_callback():
1010
bpy.context.scene.BSEQ.selected_obj_deselectall_flag = False
1111
bpy.context.scene.BSEQ.selected_obj_num = idx
1212
bpy.context.scene.BSEQ.selected_obj_deselectall_flag = True
13-
13+
if bpy.context.active_object.BSEQ.init:
14+
bpy.context.scene.BSEQ.edit_obj = bpy.context.active_object
1415

1516
def subscribe_to_selected():
1617
import bseq

bseq/operators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ def execute(self, context):
7979
return {"CANCELLED"}
8080

8181
sim_loader = context.scene.BSEQ
82+
83+
# logic here
8284
# it seems quite simple task, no need to create a function(for now)
83-
if sim_loader.selected_obj_num >= len(bpy.data.objects):
85+
obj = sim_loader.edit_obj
86+
if not obj:
8487
return {"CANCELLED"}
85-
obj = bpy.data.objects[sim_loader.selected_obj_num]
8688
if importer_prop.relative:
8789
obj.BSEQ.pattern = bpy.path.relpath(str(fs))
8890
else:

bseq/panels.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ def draw(self, context):
7373
row = layout.row()
7474
row.operator("bseq.enableselected", text="Enable Selected")
7575
row.operator("bseq.disableselected", text="Disable Selected")
76-
row = layout.row()
77-
row.operator("sequence.edit", text="Edit Path")
7876
row.operator("bseq.refresh", text="Refresh")
7977

8078

@@ -195,6 +193,11 @@ def draw(self, context):
195193
col2.prop(importer_prop, "relative", text="")
196194

197195
layout.operator("sequence.load")
196+
split = layout.split()
197+
col1 = split.column()
198+
col2 = split.column()
199+
col1.prop_search(importer_prop, 'edit_obj', bpy.data, 'objects', text="")
200+
col2.operator("sequence.edit")
198201

199202
layout.label(text="Global Settings")
200203
box = layout.box()

bseq/properties.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ class BSEQ_scene_property(bpy.types.PropertyGroup):
3232
poll=poll_material,
3333
)
3434

35+
edit_obj: bpy.props.PointerProperty(
36+
type=bpy.types.Object,
37+
poll=poll_edit_obj,
38+
)
39+
3540
print: bpy.props.BoolProperty(name='print',
3641
description="whether or not to print additional information when rendering",
3742
default=True)

0 commit comments

Comments
 (0)