feat: update apply ui icon

fix: material property filter
This commit is contained in:
Swann 2020-10-15 17:09:50 +02:00
parent 9f8222afa7
commit ff35e34032
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
2 changed files with 51 additions and 37 deletions

View File

@ -234,57 +234,69 @@ class BlMaterial(BlDatablock):
assert(instance) assert(instance)
mat_dumper = Dumper() mat_dumper = Dumper()
mat_dumper.depth = 2 mat_dumper.depth = 2
mat_dumper.exclude_filter = [ mat_dumper.include_filter = [
"is_embed_data", 'name',
"is_evaluated", 'blend_method',
"name_full", 'shadow_method',
"bl_description", 'alpha_threshold',
"bl_icon", 'show_transparent_back',
"bl_idname", 'use_backface_culling',
"bl_label", 'use_screen_refraction',
"preview", 'use_sss_translucency',
"original", 'refraction_depth',
"uuid", 'preview_render_type',
"users", 'use_preview_world',
"alpha_threshold", 'pass_index',
"line_color", 'use_nodes',
"view_center", 'diffuse_color',
'specular_color',
'roughness',
'specular_intensity',
'metallic',
'line_color',
'line_priority',
'is_grease_pencil'
] ]
data = mat_dumper.dump(instance) data = mat_dumper.dump(instance)
if instance.use_nodes: if instance.use_nodes:
nodes = {} nodes = {}
data["node_tree"] = {}
for node in instance.node_tree.nodes: for node in instance.node_tree.nodes:
nodes[node.name] = dump_node(node) nodes[node.name] = dump_node(node)
data["node_tree"]['nodes'] = nodes data["node_tree"]['nodes'] = nodes
data["node_tree"]["links"] = dump_links(instance.node_tree.links) data["node_tree"]["links"] = dump_links(instance.node_tree.links)
elif instance.is_grease_pencil:
if instance.is_grease_pencil:
gp_mat_dumper = Dumper() gp_mat_dumper = Dumper()
gp_mat_dumper.depth = 3 gp_mat_dumper.depth = 3
gp_mat_dumper.include_filter = [ gp_mat_dumper.include_filter = [
'color',
'fill_color',
'mix_color',
'mix_factor',
'mix_stroke_factor',
# 'texture_angle',
# 'texture_scale',
# 'texture_offset',
'pixel_size',
'hide',
'lock',
'ghost',
# 'texture_clamp',
'flip',
'use_overlap_strokes',
'show_stroke', 'show_stroke',
'show_fill',
'alignment_mode',
'pass_index',
'mode', 'mode',
'stroke_style', 'stroke_style',
'color', # 'stroke_image',
'use_overlap_strokes',
'show_fill',
'fill_style', 'fill_style',
'fill_color',
'pass_index',
'alignment_mode',
# 'fill_image',
'texture_opacity',
'mix_factor',
'texture_offset',
'texture_angle',
'texture_scale',
'texture_clamp',
'gradient_type', 'gradient_type',
'mix_color', # 'fill_image',
'flip'
] ]
data['grease_pencil'] = gp_mat_dumper.dump(instance.grease_pencil) data['grease_pencil'] = gp_mat_dumper.dump(instance.grease_pencil)
return data return data

View File

@ -34,9 +34,9 @@ ICONS_PROP_STATES = ['TRIA_DOWN', # ADDED
'TRIA_UP', # COMMITED 'TRIA_UP', # COMMITED
'KEYTYPE_KEYFRAME_VEC', # PUSHED 'KEYTYPE_KEYFRAME_VEC', # PUSHED
'TRIA_DOWN', # FETCHED 'TRIA_DOWN', # FETCHED
'FILE_REFRESH', # UP 'RECOVER_LAST', # RESET
'TRIA_UP', 'TRIA_UP', # CHANGED
'ERROR'] # CHANGED 'ERROR'] # ERROR
def printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='', fill_empty=' '): def printProgressBar(iteration, total, prefix='', suffix='', decimals=1, length=100, fill='', fill_empty=' '):
@ -492,10 +492,12 @@ def draw_property(context, parent, property_uuid, level=0):
detail_item_box.separator() detail_item_box.separator()
if item.state in [FETCHED, UP]: if item.state in [FETCHED, UP]:
detail_item_box.operator( apply = detail_item_box.operator(
"session.apply", "session.apply",
text="", text="",
icon=ICONS_PROP_STATES[item.state]).target = item.uuid icon=ICONS_PROP_STATES[item.state])
apply.target = item.uuid
apply.reset_dependencies = True
elif item.state in [MODIFIED, ADDED]: elif item.state in [MODIFIED, ADDED]:
detail_item_box.operator( detail_item_box.operator(
"session.commit", "session.commit",