Esempio n. 1
0
    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        layout.use_property_decorate = False
        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.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=ui_icons.get_id("haxe"))
Esempio n. 2
0
    def draw_item(self, context, layout, data, item, icon, active_data,
                  active_propname, index):
        layout.use_property_split = False

        custom_icon = "NONE"
        custom_icon_value = 0
        if item.type_prop == "Haxe Script":
            custom_icon_value = ui_icons.get_id("haxe")
        elif item.type_prop == "WebAssembly":
            custom_icon_value = ui_icons.get_id("wasm")
        elif item.type_prop == "UI Canvas":
            custom_icon = "NODE_COMPOSITING"
        elif item.type_prop == "Bundled Script":
            custom_icon_value = ui_icons.get_id("bundle")
        elif item.type_prop == "Logic Nodes":
            custom_icon = 'NODETREE'

        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            row = layout.row()
            row.separator(factor=0.1)
            row.prop(item, "enabled_prop")
            # Display " " for props without a name to right-align the
            # fake_user button
            row.label(text=item.name if item.name != "" else " ",
                      icon=custom_icon,
                      icon_value=custom_icon_value)

        elif self.layout_type in {'GRID'}:
            layout.alignment = 'CENTER'
            layout.label(text="",
                         icon=custom_icon,
                         icon_value=custom_icon_value)

        row = layout.row(align=True)
        row.prop(item,
                 "fake_user",
                 text="",
                 icon="FAKE_USER_ON" if item.fake_user else "FAKE_USER_OFF")
Esempio n. 3
0
import arm.ui_icons as ui_icons
import arm.utils
import arm.write_data as write_data

if arm.is_reload(__name__):
    arm.make = arm.reload_module(arm.make)
    arm.props_traits_props = arm.reload_module(arm.props_traits_props)
    from arm.props_traits_props import *
    proxy = arm.reload_module(proxy)
    ui_icons = arm.reload_module(ui_icons)
    arm.utils = arm.reload_module(arm.utils)
    arm.write_data = arm.reload_module(arm.write_data)
else:
    arm.enable_reload(__name__)

ICON_HAXE = ui_icons.get_id('haxe')
ICON_NODES = 'NODETREE'
ICON_CANVAS = 'NODE_COMPOSITING'
ICON_BUNDLED = ui_icons.get_id('bundle')
ICON_WASM = ui_icons.get_id('wasm')

# Pay attention to the ID number parameter for backward compatibility!
# This is important if the enum is reordered or the string identifier
# is changed as the number is what's stored in the blend file
PROP_TYPES_ENUM = [
    ('Haxe Script', 'Haxe', 'Haxe script', ICON_HAXE, 0),
    ('Logic Nodes', 'Nodes', 'Logic nodes (visual scripting)', ICON_NODES, 4),
    ('UI Canvas', 'UI', 'User interface', ICON_CANVAS, 2),
    ('Bundled Script', 'Bundled', 'Premade script with common functionality',
     ICON_BUNDLED, 3), ('WebAssembly', 'Wasm', 'WebAssembly', ICON_WASM, 1)
]