From 40daded8b488c48fa4126b752780999962e45056 Mon Sep 17 00:00:00 2001 From: Lubos Lenco Date: Tue, 3 Jan 2017 01:03:09 +0100 Subject: [PATCH] Parse emission socket --- blender/material/cycles.py | 14 +++++++++++++- blender/props_ui.py | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/blender/material/cycles.py b/blender/material/cycles.py index ec3c3202..07a4e075 100644 --- a/blender/material/cycles.py +++ b/blender/material/cycles.py @@ -142,23 +142,35 @@ def parse_shader(node, socket): if node.node_tree.name.startswith('Armory PBR'): if parse_surface: + # Base color parsing_basecol = True out_basecol = parse_vector_input(node.inputs[0]) parsing_basecol = False - # TODO: deprecated, occlussion is value instead of vector now + # Occlusion TODO: deprecated, occlussion is value instead of vector now if node.inputs[1].type == 'RGBA': out_occlusion = '{0}.r'.format(parse_vector_input(node.inputs[1])) else: out_occlusion = parse_value_input(node.inputs[1]) if node.inputs[2].is_linked or node.inputs[2].default_value != 1.0: out_occlusion = '({0} * {1})'.format(out_occlusion, parse_value_input(node.inputs[2])) + # Roughness out_roughness = parse_value_input(node.inputs[3]) if node.inputs[4].is_linked or node.inputs[4].default_value != 1.0: out_roughness = '({0} * {1})'.format(out_roughness, parse_value_input(node.inputs[4])) + # Metallic out_metallic = parse_value_input(node.inputs[5]) + # Normal if node.inputs[6].is_linked and node.inputs[6].links[0].from_node.type == 'NORMAL_MAP': log.warn(mat_state.material.name + ' - Do not use Normal Map node with Armory PBR, connect Image Texture directly') parse_normal_map_color_input(node.inputs[6], node.inputs[7]) + # Emission + if node.inputs[8].is_linked: + parsing_basecol = True + out_emission = parse_vector_input(node.inputs[8]) + parsing_basecol = False + if node.inputs[9].is_linked or node.inputs[9].default_value != 1.0: + out_emission = '({0} * {1})'.format(out_emission, parse_value_input(node.inputs[9])) + out_basecol = '({0} + {1})'.format(out_basecol, out_emission) if parse_opacity: out_opacity = parse_value_input(node.inputs[12]) diff --git a/blender/props_ui.py b/blender/props_ui.py index 040d5382..2b693ace 100644 --- a/blender/props_ui.py +++ b/blender/props_ui.py @@ -465,7 +465,9 @@ class ArmoryPlayInViewportButton(bpy.types.Operator): nodes_renderpath.check_default() assets.invalidate_enabled = False - if state.playproc == None: + if state.playproc == None and state.krom_running == False: + if context.area.type != 'VIEW_3D': + return {"CANCELLED"} log.clear() # Cancel viewport render for space in context.area.spaces: