Skip to content

Commit 8686604

Browse files
committed
fix for confusing sequence selection
1 parent ce0271e commit 8686604

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

simloader/callback.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ def item_fileseq(self, context):
3535

3636

3737
def update_selected_obj_num(self, context):
38-
38+
3939
# Here is when select sequences, then change the corresponding object to active object
4040
index = context.scene.SIMLOADER.selected_obj_num
4141
obj = bpy.data.objects[index]
4242

43-
# TODO: maybe better way to deal with this?
44-
# bpy.ops.object.select_all(action="DESELECT")
43+
if context.scene.SIMLOADER.selected_obj_deselectall_flag:
44+
bpy.ops.object.select_all(action="DESELECT")
4545
obj.select_set(True)
4646
context.view_layer.objects.active = obj
4747

48+
4849
def poll_material(self, material):
4950
return not material.is_grease_pencil

simloader/messanger.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import bpy
22

3+
34
def selected_callback():
45
if not bpy.context.view_layer.objects.active:
56
return
67
name = bpy.context.active_object.name
78
idx = bpy.data.objects.find(name)
89
if idx >= 0:
10+
bpy.context.scene.SIMLOADER.selected_obj_deselectall_flag = False
911
bpy.context.scene.SIMLOADER.selected_obj_num = idx
12+
bpy.context.scene.SIMLOADER.selected_obj_deselectall_flag = True
13+
1014

1115
def subscribe_to_selected():
1216
# A known problem of this function,
@@ -26,4 +30,3 @@ def subscribe_to_selected():
2630
def unsubscribe_to_selected():
2731
import simloader
2832
bpy.msgbus.clear_by_owner(simloader)
29-

simloader/panels.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn
2424
if item:
2525
row = layout.row()
2626
row.prop(item, "name", text='Name ', emboss=False)
27-
if item in bpy.context.selected_objects:
28-
layout.label(text="Selected",icon = "CHECKMARK")
29-
else:
30-
layout.label(text="Not-Selected",icon = "X")
3127
if item.SIMLOADER.enabled:
3228
row.prop(item.SIMLOADER, "enabled", text = "ENABLED", icon="PLAY")
3329
else:

simloader/properties.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ class SIMLOADER_scene_property(bpy.types.PropertyGroup):
1818
default=False)
1919
pattern: bpy.props.StringProperty(name="Pattern",
2020
description="You can specify the pattern here, in case the sequence can't be deteced.")
21+
22+
selected_obj_deselectall_flag: bpy.props.BoolProperty(default=True,
23+
description="the flag to determine whether call deselect all or not ")
2124
selected_obj_num: bpy.props.IntProperty(name='imported count',
2225
description='the number of imported sequence, when selecting from ui list',
2326
default=0,
2427
update=update_selected_obj_num)
25-
selected_attribute_num: bpy.props.IntProperty(default=0,
26-
# update=update_imported_num
27-
)
28+
selected_attribute_num: bpy.props.IntProperty(default=0)
29+
2830
material: bpy.props.PointerProperty(
2931
type=bpy.types.Material,
3032
poll=poll_material,

0 commit comments

Comments
 (0)