Merge pull request #2065 from MoritzBrueckner/node-side-panel

Improve node side panel + context menu (more operators, icons)
This commit is contained in:
Lubos Lenco 2020-12-23 13:08:38 +01:00 committed by GitHub
commit 569b2daecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 14 deletions

View file

@ -7,6 +7,7 @@ from bpy.props import BoolProperty, StringProperty
import arm.logicnode.arm_nodes as arm_nodes
import arm.logicnode.replacement
import arm.logicnode
import arm.props_traits
import arm.utils
registered_nodes = []
@ -154,7 +155,7 @@ class ARM_PT_LogicNodePanel(bpy.types.Panel):
bl_idname = 'ARM_PT_LogicNodePanel'
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
bl_category = 'Node'
bl_category = 'Armory'
@classmethod
def poll(cls, context):
@ -164,15 +165,21 @@ class ARM_PT_LogicNodePanel(bpy.types.Panel):
layout = self.layout
layout.use_property_split = True
layout.use_property_decorate = False
if context.active_node != None and context.active_node.bl_idname.startswith('LN'):
if context.active_node is not None and context.active_node.bl_idname.startswith('LN'):
layout.prop(context.active_node, 'arm_logic_id')
layout.prop(context.active_node, 'arm_watch')
layout.operator('arm.open_node_source')
class ArmOpenNodeSource(bpy.types.Operator):
layout.separator()
layout.operator('arm.open_node_documentation', icon='HELP')
column = layout.column(align=True)
column.operator('arm.open_node_python_source', icon='FILE_SCRIPT')
column.operator('arm.open_node_haxe_source', icon_value=arm.props_traits.icons_dict['haxe'].icon_id)
class ArmOpenNodeHaxeSource(bpy.types.Operator):
"""Expose Haxe source"""
bl_idname = 'arm.open_node_source'
bl_label = 'Open Node Source'
bl_idname = 'arm.open_node_haxe_source'
bl_label = 'Open Node Haxe Source'
def execute(self, context):
if context.selected_nodes is not None:
@ -203,7 +210,7 @@ class ArmOpenNodePythonSource(bpy.types.Operator):
return{'FINISHED'}
class ArmOpenNodeWikiEntry(bpy.types.Operator):
"""Expose Python source"""
"""Open the node's documentation in the wiki"""
bl_idname = 'arm.open_node_documentation'
bl_label = 'Open Node Documentation'
@ -228,7 +235,7 @@ class ARM_PT_Variables(bpy.types.Panel):
bl_idname = 'ARM_PT_Variables'
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
bl_category = 'Node'
bl_category = 'Armory'
@classmethod
def poll(cls, context):
@ -358,7 +365,7 @@ def register():
bpy.utils.register_class(ArmLogicTree)
bpy.utils.register_class(ARM_PT_LogicNodePanel)
bpy.utils.register_class(ArmOpenNodeSource)
bpy.utils.register_class(ArmOpenNodeHaxeSource)
bpy.utils.register_class(ArmOpenNodePythonSource)
bpy.utils.register_class(ArmOpenNodeWikiEntry)
bpy.utils.register_class(ReplaceNodesOperator)
@ -383,7 +390,7 @@ def unregister():
bpy.utils.unregister_class(ReplaceNodesOperator)
bpy.utils.unregister_class(ArmLogicTree)
bpy.utils.unregister_class(ARM_PT_LogicNodePanel)
bpy.utils.unregister_class(ArmOpenNodeSource)
bpy.utils.unregister_class(ArmOpenNodeHaxeSource)
bpy.utils.unregister_class(ArmOpenNodePythonSource)
bpy.utils.unregister_class(ArmOpenNodeWikiEntry)
bpy.utils.unregister_class(ARM_PT_Variables)

View file

@ -13,6 +13,8 @@ import arm.proxy as proxy
import arm.utils
import arm.write_data as write_data
icons_dict: bpy.utils.previews.ImagePreviewCollection
def trigger_recompile(self, context):
wrd = bpy.data.worlds['Arm']

View file

@ -12,6 +12,7 @@ import arm.make as make
import arm.make_state as state
import arm.props as props
import arm.props_properties
import arm.props_traits
import arm.nodes_logic
import arm.proxy
import arm.utils
@ -2215,7 +2216,7 @@ class ARM_PT_MaterialNodePanel(bpy.types.Panel):
bl_idname = 'ARM_PT_MaterialNodePanel'
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
bl_category = 'Node'
bl_category = 'Armory'
@classmethod
def poll(cls, context):
@ -2524,9 +2525,9 @@ def draw_custom_node_menu(self, context):
if context.selected_nodes[0].bl_idname.startswith('LN'):
layout = self.layout
layout.separator()
layout.operator("arm.open_node_documentation", text="Show documentation for this node")
layout.operator("arm.open_node_source", text="Open .hx source in the browser")
layout.operator("arm.open_node_python_source", text="Open .py source in the browser")
layout.operator("arm.open_node_documentation", text="Show documentation for this node", icon='HELP')
layout.operator("arm.open_node_haxe_source", text="Open .hx source in the browser", icon_value=arm.props_traits.icons_dict['haxe'].icon_id)
layout.operator("arm.open_node_python_source", text="Open .py source in the browser", icon='FILE_SCRIPT')
elif context.space_data.tree_type == 'ShaderNodeTree':
if context.active_node.bl_idname in ('ShaderNodeRGB', 'ShaderNodeValue', 'ShaderNodeTexImage'):