fix: filter
This commit is contained in:
parent
f0b03c50f2
commit
50d6c6b3c8
@ -491,6 +491,11 @@ class SessionProps(bpy.types.PropertyGroup):
|
|||||||
description='Show only owned datablocks',
|
description='Show only owned datablocks',
|
||||||
default=True
|
default=True
|
||||||
)
|
)
|
||||||
|
filter_name: bpy.props.StringProperty(
|
||||||
|
name="filter_name",
|
||||||
|
default="",
|
||||||
|
description='Node name filter',
|
||||||
|
)
|
||||||
admin: bpy.props.BoolProperty(
|
admin: bpy.props.BoolProperty(
|
||||||
name="admin",
|
name="admin",
|
||||||
description='Connect as admin',
|
description='Connect as admin',
|
||||||
|
@ -540,35 +540,33 @@ class SESSION_PT_repository(bpy.types.Panel):
|
|||||||
else:
|
else:
|
||||||
row.operator('session.save', icon="FILE_TICK")
|
row.operator('session.save', icon="FILE_TICK")
|
||||||
|
|
||||||
flow = layout.grid_flow(
|
box = layout.box()
|
||||||
row_major=True,
|
row = box.row()
|
||||||
columns=0,
|
row.prop(runtime_settings, "filter_owned", text="Show only owned Nodes", icon_only=True, icon="DECORATE_UNLOCKED")
|
||||||
even_columns=True,
|
row = box.row()
|
||||||
even_rows=False,
|
row.prop(runtime_settings, "filter_name", text="Filter")
|
||||||
align=True)
|
row = box.row()
|
||||||
|
|
||||||
for item in settings.supported_datablocks:
|
|
||||||
col = flow.column(align=True)
|
|
||||||
col.prop(item, "use_as_filter", text="", icon=item.icon)
|
|
||||||
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.prop(runtime_settings, "filter_owned", text="Show only owned")
|
|
||||||
|
|
||||||
row = layout.row(align=True)
|
|
||||||
|
|
||||||
# Properties
|
# Properties
|
||||||
types_filter = [t.type_name for t in settings.supported_datablocks
|
types_filter = [t.type_name for t in settings.supported_datablocks
|
||||||
if t.use_as_filter]
|
if t.use_as_filter]
|
||||||
|
|
||||||
client_keys = session.list()
|
filtered_node = session.list(filter_owner=settings.username) if runtime_settings.filter_owned else session.list()
|
||||||
|
|
||||||
if client_keys:
|
if runtime_settings.filter_name:
|
||||||
|
for node_id in filtered_node:
|
||||||
|
node_instance = session.repository.get_node(node_id)
|
||||||
|
name = node_instance.data.get('name')
|
||||||
|
if runtime_settings.filter_name not in name:
|
||||||
|
filtered_node.remove(node_id)
|
||||||
|
|
||||||
|
if filtered_node:
|
||||||
col = layout.column(align=True)
|
col = layout.column(align=True)
|
||||||
for key in client_keys:
|
for key in filtered_node:
|
||||||
draw_property(context, col, key)
|
draw_property(context, col, key)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
row.label(text="Empty")
|
layout.row().label(text="Empty")
|
||||||
|
|
||||||
elif session.state == STATE_LOBBY and usr and usr['admin']:
|
elif session.state == STATE_LOBBY and usr and usr['admin']:
|
||||||
row.operator("session.init", icon='TOOL_SETTINGS', text="Init")
|
row.operator("session.init", icon='TOOL_SETTINGS', text="Init")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user