2015-10-30 13:23:09 +01:00
|
|
|
import shutil
|
|
|
|
import bpy
|
2017-03-15 12:30:14 +01:00
|
|
|
import subprocess
|
2015-10-30 13:23:09 +01:00
|
|
|
import os
|
|
|
|
import json
|
|
|
|
from bpy.types import Menu, Panel, UIList
|
|
|
|
from bpy.props import *
|
2017-03-15 12:30:14 +01:00
|
|
|
from arm.props_traits_params import *
|
|
|
|
import arm.utils
|
|
|
|
import arm.write_data as write_data
|
2015-10-30 13:23:09 +01:00
|
|
|
|
|
|
|
class ListTraitItem(bpy.types.PropertyGroup):
|
|
|
|
# Group of properties representing an item in the list
|
|
|
|
name = bpy.props.StringProperty(
|
|
|
|
name="Name",
|
|
|
|
description="A name for this item",
|
2016-07-10 00:51:39 +02:00
|
|
|
default="")
|
2015-10-30 13:23:09 +01:00
|
|
|
|
|
|
|
enabled_prop = bpy.props.BoolProperty(
|
|
|
|
name="",
|
|
|
|
description="A name for this item",
|
|
|
|
default=True)
|
|
|
|
|
|
|
|
type_prop = bpy.props.EnumProperty(
|
2016-08-22 23:18:30 +02:00
|
|
|
items = [('Haxe Script', 'Haxe Script', 'Haxe Script'),
|
2016-08-21 00:16:13 +02:00
|
|
|
('JS Script', 'JS Script', 'JS Script'),
|
2017-05-26 16:05:14 +02:00
|
|
|
('UI Canvas', 'UI Canvas', 'UI Canvas'),
|
2017-05-27 10:42:06 +02:00
|
|
|
('Bundled Script', 'Bundled Script', 'Bundled Script'),
|
2016-08-29 09:56:34 +02:00
|
|
|
('Logic Nodes', 'Logic Nodes', 'Logic Nodes')
|
2015-10-30 13:23:09 +01:00
|
|
|
],
|
|
|
|
name = "Type")
|
|
|
|
|
|
|
|
class_name_prop = bpy.props.StringProperty(
|
|
|
|
name="Class",
|
|
|
|
description="A name for this item",
|
2016-07-10 00:51:39 +02:00
|
|
|
default="")
|
2015-10-30 13:23:09 +01:00
|
|
|
|
2017-05-26 16:05:14 +02:00
|
|
|
canvas_name_prop = bpy.props.StringProperty(
|
|
|
|
name="Canvas",
|
|
|
|
description="A name for this item",
|
|
|
|
default="")
|
|
|
|
|
2016-08-21 00:16:13 +02:00
|
|
|
jsscript_prop = bpy.props.StringProperty(
|
|
|
|
name="Text",
|
|
|
|
description="A name for this item",
|
|
|
|
default="")
|
|
|
|
|
2015-10-30 13:23:09 +01:00
|
|
|
nodes_name_prop = bpy.props.StringProperty(
|
|
|
|
name="Nodes",
|
|
|
|
description="A name for this item",
|
|
|
|
default="")
|
|
|
|
|
2016-07-17 20:29:53 +02:00
|
|
|
my_paramstraitlist = bpy.props.CollectionProperty(type=ListParamsTraitItem)
|
2016-07-17 23:29:30 +02:00
|
|
|
paramstraitlist_index = bpy.props.IntProperty(name="Index for my_list", default=0)
|
2016-07-10 00:51:39 +02:00
|
|
|
|
2015-10-30 13:23:09 +01:00
|
|
|
class MY_UL_TraitList(bpy.types.UIList):
|
|
|
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
|
|
|
# We could write some code to decide which icon to use here...
|
|
|
|
custom_icon = 'OBJECT_DATAMODE'
|
|
|
|
|
|
|
|
# Make sure your code supports all 3 layout types
|
|
|
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
|
|
|
layout.prop(item, "enabled_prop")
|
2016-08-29 09:56:34 +02:00
|
|
|
layout.label(item.name, icon=custom_icon)
|
2015-10-30 13:23:09 +01:00
|
|
|
|
|
|
|
elif self.layout_type in {'GRID'}:
|
|
|
|
layout.alignment = 'CENTER'
|
|
|
|
layout.label("", icon = custom_icon)
|
|
|
|
|
|
|
|
def initObjectProperties():
|
2016-12-05 01:54:01 +01:00
|
|
|
bpy.types.Object.my_traitlist = bpy.props.CollectionProperty(type=ListTraitItem)
|
|
|
|
bpy.types.Object.traitlist_index = bpy.props.IntProperty(name="Index for my_list", default=0)
|
2015-11-28 21:51:42 +01:00
|
|
|
|
2015-10-30 13:23:09 +01:00
|
|
|
|
|
|
|
class LIST_OT_TraitNewItem(bpy.types.Operator):
|
|
|
|
# Add a new item to the list
|
|
|
|
bl_idname = "my_traitlist.new_item"
|
|
|
|
bl_label = "Add a new item"
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
bpy.context.object.my_traitlist.add()
|
2016-07-17 23:29:30 +02:00
|
|
|
bpy.context.object.traitlist_index = len(bpy.context.object.my_traitlist) - 1
|
2015-10-30 13:23:09 +01:00
|
|
|
return{'FINISHED'}
|
|
|
|
|
|
|
|
|
|
|
|
class LIST_OT_TraitDeleteItem(bpy.types.Operator):
|
|
|
|
# Delete the selected item from the list
|
|
|
|
bl_idname = "my_traitlist.delete_item"
|
|
|
|
bl_label = "Deletes an item"
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(self, context):
|
|
|
|
""" Enable if there's something in the list """
|
|
|
|
return len(bpy.context.object.my_traitlist) > 0
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
list = bpy.context.object.my_traitlist
|
|
|
|
index = bpy.context.object.traitlist_index
|
|
|
|
|
|
|
|
list.remove(index)
|
|
|
|
|
|
|
|
if index > 0:
|
|
|
|
index = index - 1
|
|
|
|
|
|
|
|
bpy.context.object.traitlist_index = index
|
|
|
|
return{'FINISHED'}
|
|
|
|
|
|
|
|
|
|
|
|
class LIST_OT_TraitMoveItem(bpy.types.Operator):
|
|
|
|
# Move an item in the list
|
|
|
|
bl_idname = "my_traitlist.move_item"
|
|
|
|
bl_label = "Move an item in the list"
|
|
|
|
direction = bpy.props.EnumProperty(
|
|
|
|
items=(
|
|
|
|
('UP', 'Up', ""),
|
|
|
|
('DOWN', 'Down', ""),))
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def poll(self, context):
|
|
|
|
""" Enable if there's something in the list. """
|
|
|
|
return len(bpy.context.object.my_traitlist) > 0
|
|
|
|
|
|
|
|
|
|
|
|
def move_index(self):
|
|
|
|
# Move index of an item render queue while clamping it
|
|
|
|
index = bpy.context.object.traitlist_index
|
|
|
|
list_length = len(bpy.context.object.my_traitlist) - 1
|
|
|
|
new_index = 0
|
|
|
|
|
|
|
|
if self.direction == 'UP':
|
|
|
|
new_index = index - 1
|
|
|
|
elif self.direction == 'DOWN':
|
|
|
|
new_index = index + 1
|
|
|
|
|
|
|
|
new_index = max(0, min(new_index, list_length))
|
|
|
|
index = new_index
|
|
|
|
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
list = bpy.context.object.my_traitlist
|
|
|
|
index = bpy.context.object.traitlist_index
|
|
|
|
|
|
|
|
if self.direction == 'DOWN':
|
|
|
|
neighbor = index + 1
|
|
|
|
#queue.move(index,neighbor)
|
|
|
|
self.move_index()
|
|
|
|
|
|
|
|
elif self.direction == 'UP':
|
|
|
|
neighbor = index - 1
|
|
|
|
#queue.move(neighbor, index)
|
|
|
|
self.move_index()
|
|
|
|
else:
|
|
|
|
return{'CANCELLED'}
|
|
|
|
return{'FINISHED'}
|
|
|
|
|
2016-07-10 00:51:39 +02:00
|
|
|
class ArmoryEditScriptButton(bpy.types.Operator):
|
2016-09-23 00:34:42 +02:00
|
|
|
'''Edit script in Kode Studio'''
|
2016-07-10 00:51:39 +02:00
|
|
|
bl_idname = 'arm.edit_script'
|
|
|
|
bl_label = 'Edit Script'
|
|
|
|
|
|
|
|
def execute(self, context):
|
2017-03-15 12:30:14 +01:00
|
|
|
project_path = arm.utils.get_fp()
|
2017-05-13 17:17:43 +02:00
|
|
|
item = context.object.my_traitlist[context.object.traitlist_index]
|
|
|
|
pkg = arm.utils.safestr(bpy.data.worlds['Arm'].arm_project_package)
|
|
|
|
hx_path = project_path + '/Sources/' + pkg + '/' + item.class_name_prop + '.hx'
|
2016-11-01 00:30:10 +01:00
|
|
|
|
2017-03-15 12:30:14 +01:00
|
|
|
sdk_path = arm.utils.get_sdk_path()
|
|
|
|
if arm.utils.get_os() == 'win':
|
2016-11-01 12:02:58 +01:00
|
|
|
kode_path = sdk_path + '/win32/Kode Studio.exe'
|
2017-03-15 12:30:14 +01:00
|
|
|
subprocess.Popen([kode_path, arm.utils.get_fp(), hx_path])
|
|
|
|
elif arm.utils.get_os() == 'mac':
|
2016-11-01 12:02:58 +01:00
|
|
|
kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"'
|
2017-03-28 14:30:51 +02:00
|
|
|
subprocess.Popen([kode_path + ' "' + arm.utils.get_fp() + '" "' + hx_path + '"'], shell=True)
|
2016-08-15 12:08:50 +02:00
|
|
|
else:
|
2016-11-01 12:02:58 +01:00
|
|
|
kode_path = sdk_path + '/linux64/kodestudio'
|
2017-03-15 12:30:14 +01:00
|
|
|
subprocess.Popen([kode_path, arm.utils.get_fp(), hx_path])
|
2016-11-01 00:30:10 +01:00
|
|
|
|
2016-07-10 00:51:39 +02:00
|
|
|
return{'FINISHED'}
|
|
|
|
|
2017-02-24 21:29:49 +01:00
|
|
|
class ArmoryEditBundledScriptButton(bpy.types.Operator):
|
|
|
|
'''Copy script to project and edit in Kode Studio'''
|
|
|
|
bl_idname = 'arm.edit_bundled_script'
|
|
|
|
bl_label = 'Edit Script'
|
|
|
|
|
|
|
|
def execute(self, context):
|
2017-03-15 12:30:14 +01:00
|
|
|
sdk_path = arm.utils.get_sdk_path()
|
|
|
|
project_path = arm.utils.get_fp()
|
2017-05-13 17:17:43 +02:00
|
|
|
pkg = arm.utils.safestr(bpy.data.worlds['Arm'].arm_project_package)
|
2017-02-24 21:29:49 +01:00
|
|
|
item = context.object.my_traitlist[context.object.traitlist_index]
|
|
|
|
source_hx_path = sdk_path + '/armory/Sources/armory/trait/' + item.class_name_prop + '.hx'
|
|
|
|
target_hx_path = project_path + '/Sources/' + pkg + '/' + item.class_name_prop + '.hx'
|
|
|
|
|
|
|
|
if not os.path.isfile(target_hx_path):
|
|
|
|
# Rewrite package and copy
|
|
|
|
sf = open(source_hx_path)
|
|
|
|
sf.readline()
|
|
|
|
tf = open(target_hx_path, 'w')
|
|
|
|
tf.write('package ' + pkg + ';\n')
|
|
|
|
shutil.copyfileobj(sf, tf)
|
|
|
|
sf.close()
|
|
|
|
tf.close()
|
2017-03-15 12:30:14 +01:00
|
|
|
arm.utils.fetch_script_names()
|
2017-02-24 21:29:49 +01:00
|
|
|
|
|
|
|
# From bundled to script
|
|
|
|
item.type_prop = 'Haxe Script'
|
|
|
|
|
|
|
|
# Edit in Kode Studio
|
|
|
|
bpy.ops.arm.edit_script('EXEC_DEFAULT')
|
|
|
|
|
|
|
|
return{'FINISHED'}
|
|
|
|
|
2017-05-26 16:05:14 +02:00
|
|
|
class ArmoryEditCanvasButton(bpy.types.Operator):
|
|
|
|
'''Edit ui canvas'''
|
|
|
|
bl_idname = 'arm.edit_canvas'
|
|
|
|
bl_label = 'Edit Canvas'
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
project_path = arm.utils.get_fp()
|
|
|
|
item = context.object.my_traitlist[context.object.traitlist_index]
|
|
|
|
canvas_path = project_path + '/Bundled/canvas/' + item.canvas_name_prop + '.json'
|
|
|
|
write_data.write_canvasprefs(canvas_path)
|
|
|
|
|
|
|
|
sdk_path = arm.utils.get_sdk_path()
|
|
|
|
electron_app_path = sdk_path + '/armory/tools/armorui/electron.js'
|
|
|
|
if arm.utils.get_os() == 'win':
|
|
|
|
electron_path = sdk_path + 'win32/Kode Studio.exe'
|
|
|
|
elif arm.utils.get_os() == 'mac':
|
|
|
|
electron_path = sdk_path + 'Kode Studio.app/Contents/MacOS/Electron'
|
|
|
|
else:
|
|
|
|
electron_path = sdk_path + 'linux64/kodestudio'
|
|
|
|
subprocess.Popen([electron_path, '--chromedebug', '--remote-debugging-port=9222', '--enable-logging', electron_app_path, canvas_path])
|
|
|
|
|
|
|
|
return{'FINISHED'}
|
|
|
|
|
2016-07-10 00:51:39 +02:00
|
|
|
class ArmoryNewScriptDialog(bpy.types.Operator):
|
2016-09-23 00:34:42 +02:00
|
|
|
'''Create blank script'''
|
2016-07-10 00:51:39 +02:00
|
|
|
bl_idname = "arm.new_script"
|
|
|
|
bl_label = "New Script"
|
|
|
|
|
|
|
|
class_name = StringProperty(name="Name")
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
self.class_name = self.class_name.replace(' ', '')
|
|
|
|
write_data.write_traithx(self.class_name)
|
2017-03-15 12:30:14 +01:00
|
|
|
arm.utils.fetch_script_names()
|
2016-07-10 00:51:39 +02:00
|
|
|
obj = context.object
|
|
|
|
item = obj.my_traitlist[obj.traitlist_index]
|
|
|
|
item.class_name_prop = self.class_name
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
2017-03-15 12:30:14 +01:00
|
|
|
if not arm.utils.check_saved(self):
|
2016-12-08 14:38:04 +01:00
|
|
|
return {'CANCELLED'}
|
2016-07-10 00:51:39 +02:00
|
|
|
self.class_name = 'MyTrait'
|
|
|
|
return context.window_manager.invoke_props_dialog(self)
|
|
|
|
|
2017-05-26 16:05:14 +02:00
|
|
|
class ArmoryNewCanvasDialog(bpy.types.Operator):
|
|
|
|
'''Create blank canvas'''
|
|
|
|
bl_idname = "arm.new_canvas"
|
|
|
|
bl_label = "New Canvas"
|
|
|
|
|
|
|
|
canvas_name = StringProperty(name="Name")
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
self.canvas_name = self.canvas_name.replace(' ', '')
|
|
|
|
write_data.write_canvasjson(self.canvas_name)
|
|
|
|
arm.utils.fetch_script_names()
|
|
|
|
obj = context.object
|
|
|
|
item = obj.my_traitlist[obj.traitlist_index]
|
|
|
|
item.canvas_name_prop = self.canvas_name
|
|
|
|
return {'FINISHED'}
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
if not arm.utils.check_saved(self):
|
|
|
|
return {'CANCELLED'}
|
|
|
|
self.canvas_name = 'MyCanvas'
|
|
|
|
return context.window_manager.invoke_props_dialog(self)
|
|
|
|
|
2016-07-10 00:51:39 +02:00
|
|
|
class ArmoryRefreshScriptsListButton(bpy.types.Operator):
|
2016-09-23 00:34:42 +02:00
|
|
|
'''Fetch all script names'''
|
2016-07-10 00:51:39 +02:00
|
|
|
bl_idname = 'arm.refresh_scripts_list'
|
|
|
|
bl_label = 'Refresh Scripts List'
|
|
|
|
|
|
|
|
def execute(self, context):
|
2017-03-15 12:30:14 +01:00
|
|
|
arm.utils.fetch_bundled_script_names()
|
|
|
|
arm.utils.fetch_script_names()
|
2016-07-10 00:51:39 +02:00
|
|
|
return{'FINISHED'}
|
2015-10-30 13:23:09 +01:00
|
|
|
|
2017-05-26 16:05:14 +02:00
|
|
|
class ArmoryRefreshCanvasListButton(bpy.types.Operator):
|
|
|
|
'''Fetch all canvas names'''
|
|
|
|
bl_idname = 'arm.refresh_canvas_list'
|
|
|
|
bl_label = 'Refresh Canvas List'
|
|
|
|
|
|
|
|
def execute(self, context):
|
|
|
|
arm.utils.fetch_script_names()
|
|
|
|
return{'FINISHED'}
|
|
|
|
|
2015-10-30 13:23:09 +01:00
|
|
|
# Menu in tools region
|
|
|
|
class ToolsTraitsPanel(bpy.types.Panel):
|
2016-07-10 00:51:39 +02:00
|
|
|
bl_label = "Armory Traits"
|
2015-10-30 13:23:09 +01:00
|
|
|
bl_space_type = "PROPERTIES"
|
|
|
|
bl_region_type = "WINDOW"
|
|
|
|
bl_context = "object"
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
layout = self.layout
|
|
|
|
|
|
|
|
obj = bpy.context.object
|
|
|
|
|
|
|
|
rows = 2
|
|
|
|
if len(obj.my_traitlist) > 1:
|
|
|
|
rows = 4
|
|
|
|
|
|
|
|
row = layout.row()
|
|
|
|
row.template_list("MY_UL_TraitList", "The_List", obj, "my_traitlist", obj, "traitlist_index", rows=rows)
|
|
|
|
|
|
|
|
col = row.column(align=True)
|
|
|
|
col.operator("my_traitlist.new_item", icon='ZOOMIN', text="")
|
|
|
|
col.operator("my_traitlist.delete_item", icon='ZOOMOUT', text="")#.all = False
|
|
|
|
|
|
|
|
if len(obj.my_traitlist) > 1:
|
|
|
|
col.separator()
|
|
|
|
col.operator("my_traitlist.move_item", icon='TRIA_UP', text="").direction = 'UP'
|
|
|
|
col.operator("my_traitlist.move_item", icon='TRIA_DOWN', text="").direction = 'DOWN'
|
|
|
|
|
|
|
|
if obj.traitlist_index >= 0 and len(obj.my_traitlist) > 0:
|
2016-08-29 09:56:34 +02:00
|
|
|
item = obj.my_traitlist[obj.traitlist_index]
|
2015-10-30 13:23:09 +01:00
|
|
|
# Default props
|
|
|
|
row = layout.row()
|
|
|
|
row.prop(item, "type_prop")
|
|
|
|
|
|
|
|
# Script
|
2016-08-22 23:18:30 +02:00
|
|
|
if item.type_prop == 'Haxe Script' or item.type_prop == 'Bundled Script':
|
2015-10-30 13:23:09 +01:00
|
|
|
item.name = item.class_name_prop
|
|
|
|
row = layout.row()
|
2016-07-10 00:51:39 +02:00
|
|
|
# row.prop(item, "class_name_prop")
|
2016-08-22 23:18:30 +02:00
|
|
|
if item.type_prop == 'Haxe Script':
|
2016-09-02 23:11:04 +02:00
|
|
|
row.prop_search(item, "class_name_prop", bpy.data.worlds['Arm'], "scripts_list", "Class")
|
2016-07-10 00:51:39 +02:00
|
|
|
else:
|
2016-09-02 23:11:04 +02:00
|
|
|
row.prop_search(item, "class_name_prop", bpy.data.worlds['Arm'], "bundled_scripts_list", "Class")
|
2016-01-28 12:32:05 +01:00
|
|
|
# Params
|
|
|
|
layout.label("Parameters")
|
|
|
|
paramsrow = layout.row()
|
|
|
|
paramsrows = 2
|
2016-07-10 00:51:39 +02:00
|
|
|
if len(item.my_paramstraitlist) > 1:
|
2016-01-28 12:32:05 +01:00
|
|
|
paramsrows = 4
|
|
|
|
|
|
|
|
row = layout.row()
|
2016-07-10 00:51:39 +02:00
|
|
|
row.template_list("MY_UL_ParamsTraitList", "The_List", item, "my_paramstraitlist", item, "paramstraitlist_index", rows=paramsrows)
|
2016-01-28 12:32:05 +01:00
|
|
|
|
|
|
|
col = row.column(align=True)
|
|
|
|
col.operator("my_paramstraitlist.new_item", icon='ZOOMIN', text="")
|
|
|
|
col.operator("my_paramstraitlist.delete_item", icon='ZOOMOUT', text="")
|
|
|
|
|
2016-07-10 00:51:39 +02:00
|
|
|
if len(item.my_paramstraitlist) > 1:
|
2016-01-28 12:32:05 +01:00
|
|
|
col.separator()
|
|
|
|
col.operator("my_paramstraitlist.move_item", icon='TRIA_UP', text="").direction = 'UP'
|
|
|
|
col.operator("my_paramstraitlist.move_item", icon='TRIA_DOWN', text="").direction = 'DOWN'
|
|
|
|
|
2016-07-10 00:51:39 +02:00
|
|
|
if item.paramstraitlist_index >= 0 and len(item.my_paramstraitlist) > 0:
|
2016-07-17 23:29:30 +02:00
|
|
|
paramitem = item.my_paramstraitlist[item.paramstraitlist_index]
|
|
|
|
# Picker
|
|
|
|
layout.label('Pickers')
|
|
|
|
layout.prop_search(paramitem, 'object_picker', bpy.context.scene, "objects", "Object")
|
|
|
|
layout.prop(paramitem, 'color_picker')
|
2016-07-10 00:51:39 +02:00
|
|
|
|
2016-08-22 23:18:30 +02:00
|
|
|
if item.type_prop == 'Haxe Script':
|
2016-07-10 00:51:39 +02:00
|
|
|
row = layout.row()
|
|
|
|
if item.class_name_prop == '':
|
|
|
|
row.enabled = False
|
|
|
|
row.operator("arm.edit_script")
|
|
|
|
layout.operator("arm.new_script")
|
|
|
|
layout.operator("arm.refresh_scripts_list")
|
2017-02-24 21:29:49 +01:00
|
|
|
else: # Bundled
|
|
|
|
layout.operator("arm.edit_bundled_script")
|
2015-12-07 20:04:23 +01:00
|
|
|
|
2017-05-26 11:51:08 +02:00
|
|
|
# JS Script
|
|
|
|
elif item.type_prop == 'JS Script':
|
2016-08-21 00:16:13 +02:00
|
|
|
item.name = item.jsscript_prop
|
|
|
|
row = layout.row()
|
|
|
|
row.prop_search(item, "jsscript_prop", bpy.data, "texts", "Text")
|
|
|
|
|
2017-05-26 16:05:14 +02:00
|
|
|
# UI
|
|
|
|
elif item.type_prop == 'UI Canvas':
|
|
|
|
item.name = item.canvas_name_prop
|
|
|
|
row = layout.row()
|
|
|
|
row.prop_search(item, "canvas_name_prop", bpy.data.worlds['Arm'], "canvas_list", "Canvas")
|
|
|
|
row = layout.row()
|
|
|
|
if item.canvas_name_prop == '':
|
|
|
|
row.enabled = False
|
|
|
|
row.operator("arm.edit_canvas")
|
|
|
|
layout.operator("arm.new_canvas")
|
|
|
|
layout.operator("arm.refresh_canvas_list")
|
|
|
|
|
2015-10-30 13:23:09 +01:00
|
|
|
# Nodes
|
2016-08-22 23:18:30 +02:00
|
|
|
elif item.type_prop == 'Logic Nodes':
|
2015-10-30 13:23:09 +01:00
|
|
|
item.name = item.nodes_name_prop
|
|
|
|
row = layout.row()
|
|
|
|
row.prop_search(item, "nodes_name_prop", bpy.data, "node_groups", "Tree")
|
|
|
|
|
2017-03-15 12:30:14 +01:00
|
|
|
def register():
|
|
|
|
bpy.utils.register_class(ListTraitItem)
|
|
|
|
bpy.utils.register_class(MY_UL_TraitList)
|
|
|
|
bpy.utils.register_class(LIST_OT_TraitNewItem)
|
|
|
|
bpy.utils.register_class(LIST_OT_TraitDeleteItem)
|
|
|
|
bpy.utils.register_class(LIST_OT_TraitMoveItem)
|
|
|
|
bpy.utils.register_class(ArmoryEditScriptButton)
|
|
|
|
bpy.utils.register_class(ArmoryEditBundledScriptButton)
|
2017-05-26 16:05:14 +02:00
|
|
|
bpy.utils.register_class(ArmoryEditCanvasButton)
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.register_class(ArmoryNewScriptDialog)
|
2017-05-26 16:05:14 +02:00
|
|
|
bpy.utils.register_class(ArmoryNewCanvasDialog)
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.register_class(ArmoryRefreshScriptsListButton)
|
2017-05-26 16:05:14 +02:00
|
|
|
bpy.utils.register_class(ArmoryRefreshCanvasListButton)
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.register_class(ToolsTraitsPanel)
|
|
|
|
|
2015-12-07 20:04:23 +01:00
|
|
|
initObjectProperties()
|
|
|
|
|
|
|
|
def unregister():
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.unregister_class(ListTraitItem)
|
|
|
|
bpy.utils.unregister_class(MY_UL_TraitList)
|
|
|
|
bpy.utils.unregister_class(LIST_OT_TraitNewItem)
|
|
|
|
bpy.utils.unregister_class(LIST_OT_TraitDeleteItem)
|
|
|
|
bpy.utils.unregister_class(LIST_OT_TraitMoveItem)
|
|
|
|
bpy.utils.unregister_class(ArmoryEditScriptButton)
|
|
|
|
bpy.utils.unregister_class(ArmoryEditBundledScriptButton)
|
2017-05-26 16:05:14 +02:00
|
|
|
bpy.utils.unregister_class(ArmoryEditCanvasButton)
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.unregister_class(ArmoryNewScriptDialog)
|
2017-05-26 16:05:14 +02:00
|
|
|
bpy.utils.unregister_class(ArmoryNewCanvasDialog)
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.unregister_class(ArmoryRefreshScriptsListButton)
|
2017-05-26 16:05:14 +02:00
|
|
|
bpy.utils.unregister_class(ArmoryRefreshCanvasListButton)
|
2017-03-15 12:30:14 +01:00
|
|
|
bpy.utils.unregister_class(ToolsTraitsPanel)
|