Clear image node

This commit is contained in:
luboslenco 2017-02-23 13:30:11 +01:00
parent 3a69768c81
commit 01235bb57f
3 changed files with 32 additions and 7 deletions

View file

@ -117,6 +117,11 @@ def make_clear_target(stage, color_val=None, depth_val=None, stencil_val=None):
stage['params'].append('stencil')
stage['params'].append(str(stencil_val))
def make_clear_image(stage, image_name, color_val):
stage['command'] = 'clear_image'
stage['params'].append(image_name)
stage['params'].append(str(armutils.to_hex(color_val)))
def make_generate_mipmaps(stage, node_group, node):
stage['command'] = 'generate_mipmaps'
@ -474,6 +479,12 @@ def buildNode(stages, node, node_group):
stencil_val = node.inputs[6].default_value
make_clear_target(stage, color_val=color_val, depth_val=depth_val, stencil_val=stencil_val)
elif node.bl_idname == 'ClearImageNodeType':
image_node = node.inputs[1].links[0].from_node
image_name = image_node.inputs[0].default_value
color_val = node.inputs[2].default_value
make_clear_image(stage, image_name, color_val)
elif node.bl_idname == 'GenerateMipmapsNodeType':
make_generate_mipmaps(stage, node_group, node)

View file

@ -388,6 +388,19 @@ class ClearTargetNode(Node, CGPipelineTreeNode):
self.outputs.new('NodeSocketShader', "Stage")
class ClearImageNode(Node, CGPipelineTreeNode):
'''Clear target image node'''
bl_idname = 'ClearImageNodeType'
bl_label = 'Clear Image'
bl_icon = 'SOUND'
def init(self, context):
self.inputs.new('NodeSocketShader', "Stage")
self.inputs.new('NodeSocketShader', "Image")
self.inputs.new('NodeSocketColor', "Color")
self.outputs.new('NodeSocketShader', "Stage")
class GenerateMipmapsNode(Node, CGPipelineTreeNode):
'''Generate mipmaps node'''
bl_idname = 'GenerateMipmapsNodeType'
@ -776,6 +789,7 @@ node_categories = [
NodeItem("DrawMeshesNodeType"),
NodeItem("DrawDecalsNodeType"),
NodeItem("ClearTargetNodeType"),
NodeItem("ClearImageNodeType"),
NodeItem("GenerateMipmapsNodeType"),
NodeItem("SetTargetNodeType"),
NodeItem("SetViewportNodeType"),

View file

@ -365,21 +365,20 @@ class ArmoryPlayerPanel(bpy.types.Panel):
def draw(self, context):
layout = self.layout
wrd = bpy.data.worlds['Arm']
if state.playproc == None and state.compileproc == None:
layout.operator("arm.play", icon="PLAY")
else:
layout.operator("arm.stop", icon="MESH_PLANE")
layout.prop(wrd, 'arm_play_runtime')
row = layout.row(align=True)
row.alignment = 'EXPAND'
if state.playproc == None and state.compileproc == None:
row.operator("arm.play", icon="PLAY")
else:
row.operator("arm.stop", icon="MESH_PLANE")
if state.playproc == None and state.krom_running == False:
row.operator("arm.build")
else:
row.operator("arm.patch")
row.operator("arm.clean_menu")
layout.operator("arm.kode_studio")
layout.prop(wrd, 'arm_play_runtime')
layout.prop(wrd, 'arm_play_viewport_camera')
if wrd.arm_play_viewport_camera:
layout.prop(wrd, 'arm_play_viewport_navigation')
@ -424,6 +423,7 @@ class ArmoryProjectPanel(bpy.types.Panel):
layout.prop(wrd, 'arm_project_package')
layout.prop_search(wrd, 'arm_khafile', bpy.data, 'texts', 'Khafile')
layout.prop_search(wrd, 'arm_command_line', bpy.data, 'texts', 'Command Line')
layout.operator("arm.kode_studio")
row = layout.row(align=True)
row.alignment = 'EXPAND'
row.operator("arm.build_project")