Improve handling of custom logic nodes
This commit is contained in:
parent
38103be7d3
commit
0120910f92
|
@ -6,7 +6,7 @@ import bpy
|
|||
from bpy.app.handlers import persistent
|
||||
|
||||
import arm.api
|
||||
import arm.logicnode.arm_nodes
|
||||
import arm.logicnode.arm_nodes as arm_nodes
|
||||
import arm.nodes_logic
|
||||
import arm.make as make
|
||||
import arm.make_state as state
|
||||
|
@ -124,7 +124,10 @@ def on_load_post(context):
|
|||
# Load libraries
|
||||
if os.path.exists(arm.utils.get_fp() + '/Libraries'):
|
||||
# Don't register nodes twice when calling register_nodes()
|
||||
arm.logicnode.arm_nodes.reset_globals()
|
||||
arm_nodes.reset_globals()
|
||||
|
||||
# Make sure that Armory's categories are registered first (on top of the menu)
|
||||
arm.logicnode.init_categories()
|
||||
|
||||
libs = os.listdir(arm.utils.get_fp() + '/Libraries')
|
||||
for lib in libs:
|
||||
|
|
|
@ -5,45 +5,47 @@ import pkgutil
|
|||
import arm.logicnode.arm_nodes as arm_nodes
|
||||
import arm.logicnode.arm_sockets as arm_sockets
|
||||
|
||||
# Register node menu categories
|
||||
arm_nodes.add_category('Logic', icon='OUTLINER', section="basic",
|
||||
description="Logic nodes are used to control execution flow using branching, loops, gates etc.")
|
||||
arm_nodes.add_category('Event', icon='INFO', section="basic")
|
||||
arm_nodes.add_category('Input', icon='GREASEPENCIL', section="basic")
|
||||
arm_nodes.add_category('Native', icon='MEMORY', section="basic",
|
||||
description="The Native category contains nodes which interact with the system (Input/Output functionality, etc.) or Haxe.")
|
||||
|
||||
arm_nodes.add_category('Camera', icon='OUTLINER_OB_CAMERA', section="data")
|
||||
arm_nodes.add_category('Material', icon='MATERIAL', section="data")
|
||||
arm_nodes.add_category('Light', icon='LIGHT', section="data")
|
||||
arm_nodes.add_category('Object', icon='OBJECT_DATA', section="data")
|
||||
arm_nodes.add_category('Scene', icon='SCENE_DATA', section="data")
|
||||
arm_nodes.add_category('Trait', icon='NODETREE', section="data")
|
||||
def init_categories():
|
||||
# Register node menu categories
|
||||
arm_nodes.add_category('Logic', icon='OUTLINER', section="basic",
|
||||
description="Logic nodes are used to control execution flow using branching, loops, gates etc.")
|
||||
arm_nodes.add_category('Event', icon='INFO', section="basic")
|
||||
arm_nodes.add_category('Input', icon='GREASEPENCIL', section="basic")
|
||||
arm_nodes.add_category('Native', icon='MEMORY', section="basic",
|
||||
description="The Native category contains nodes which interact with the system (Input/Output functionality, etc.) or Haxe.")
|
||||
|
||||
arm_nodes.add_category('Animation', icon='SEQUENCE', section="motion")
|
||||
arm_nodes.add_category('Navmesh', icon='UV_VERTEXSEL', section="motion")
|
||||
arm_nodes.add_category('Transform', icon='TRANSFORM_ORIGINS', section="motion")
|
||||
arm_nodes.add_category('Physics', icon='PHYSICS', section="motion")
|
||||
arm_nodes.add_category('Camera', icon='OUTLINER_OB_CAMERA', section="data")
|
||||
arm_nodes.add_category('Material', icon='MATERIAL', section="data")
|
||||
arm_nodes.add_category('Light', icon='LIGHT', section="data")
|
||||
arm_nodes.add_category('Object', icon='OBJECT_DATA', section="data")
|
||||
arm_nodes.add_category('Scene', icon='SCENE_DATA', section="data")
|
||||
arm_nodes.add_category('Trait', icon='NODETREE', section="data")
|
||||
|
||||
arm_nodes.add_category('Array', icon='LIGHTPROBE_GRID', section="values")
|
||||
arm_nodes.add_category('Math', icon='FORCE_HARMONIC', section="values")
|
||||
arm_nodes.add_category('Random', icon='SEQ_HISTOGRAM', section="values")
|
||||
arm_nodes.add_category('String', icon='SORTALPHA', section="values")
|
||||
arm_nodes.add_category('Variable', icon='OPTIONS', section="values")
|
||||
arm_nodes.add_category('Animation', icon='SEQUENCE', section="motion")
|
||||
arm_nodes.add_category('Navmesh', icon='UV_VERTEXSEL', section="motion")
|
||||
arm_nodes.add_category('Transform', icon='TRANSFORM_ORIGINS', section="motion")
|
||||
arm_nodes.add_category('Physics', icon='PHYSICS', section="motion")
|
||||
|
||||
arm_nodes.add_category('Canvas', icon='RENDERLAYERS', section="graphics",
|
||||
description="Note: To get the canvas, be sure that the node(s) and the canvas (UI) is attached to the same object.")
|
||||
arm_nodes.add_category('Postprocess', icon='FREEZE', section="graphics")
|
||||
arm_nodes.add_category('Renderpath', icon='STICKY_UVS_LOC', section="graphics")
|
||||
arm_nodes.add_category('Array', icon='LIGHTPROBE_GRID', section="values")
|
||||
arm_nodes.add_category('Math', icon='FORCE_HARMONIC', section="values")
|
||||
arm_nodes.add_category('Random', icon='SEQ_HISTOGRAM', section="values")
|
||||
arm_nodes.add_category('String', icon='SORTALPHA', section="values")
|
||||
arm_nodes.add_category('Variable', icon='OPTIONS', section="values")
|
||||
|
||||
arm_nodes.add_category('Sound', icon='OUTLINER_OB_SPEAKER', section="sound")
|
||||
arm_nodes.add_category('Canvas', icon='RENDERLAYERS', section="graphics",
|
||||
description="Note: To get the canvas, be sure that the node(s) and the canvas (UI) is attached to the same object.")
|
||||
arm_nodes.add_category('Postprocess', icon='FREEZE', section="graphics")
|
||||
arm_nodes.add_category('Renderpath', icon='STICKY_UVS_LOC', section="graphics")
|
||||
|
||||
arm_nodes.add_category('Miscellaneous', icon='RESTRICT_COLOR_ON', section="misc")
|
||||
arm_nodes.add_category('Layout', icon='SEQ_STRIP_DUPLICATE', section="misc")
|
||||
arm_nodes.add_category('Sound', icon='OUTLINER_OB_SPEAKER', section="sound")
|
||||
|
||||
# Make sure that logic node extension packs are displayed at the end
|
||||
# of the menu by default unless they declare it otherwise
|
||||
arm_nodes.add_category_section('default')
|
||||
arm_nodes.add_category('Miscellaneous', icon='RESTRICT_COLOR_ON', section="misc")
|
||||
arm_nodes.add_category('Layout', icon='SEQ_STRIP_DUPLICATE', section="misc")
|
||||
|
||||
# Make sure that logic node extension packs are displayed at the end
|
||||
# of the menu by default unless they declare it otherwise
|
||||
arm_nodes.add_category_section('default')
|
||||
|
||||
|
||||
def init_nodes():
|
||||
|
|
|
@ -525,6 +525,7 @@ def register():
|
|||
|
||||
bpy.types.NODE_MT_context_menu.append(draw_custom_logicnode_menu)
|
||||
|
||||
arm.logicnode.init_categories()
|
||||
register_nodes()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue