Configurable project root

This commit is contained in:
Lubos Lenco 2017-10-06 18:56:05 +02:00
parent 68aa415cbd
commit ec9cedd833
5 changed files with 11 additions and 11 deletions

View file

@ -12,10 +12,7 @@ import arm.utils
import arm.nodes as nodes
def build_node_trees(assets_path):
s = bpy.data.filepath.split(os.path.sep)
s.pop()
fp = os.path.sep.join(s)
os.chdir(fp)
fp = arm.utils.get_fp()
rpdat = arm.utils.get_rp()

View file

@ -10,10 +10,7 @@ import arm.nodes as nodes
import arm.log as log
def build_node_trees(active_worlds):
s = bpy.data.filepath.split(os.path.sep)
s.pop()
fp = os.path.sep.join(s)
os.chdir(fp)
fp = arm.utils.get_fp()
# Make sure Assets dir exists
if not os.path.exists(arm.utils.build_dir() + '/compiled/Assets/materials'):

View file

@ -45,6 +45,7 @@ def init_properties():
bpy.types.World.arm_version = StringProperty(name="Version", description="Armory SDK version", default="")
bpy.types.World.arm_project_name = StringProperty(name="Name", description="Exported project name", default="")
bpy.types.World.arm_project_package = StringProperty(name="Package", description="Package name for scripts", default="arm")
bpy.types.World.arm_project_root = StringProperty(name="Root", description="Set root folder for linked assets", default="", subtype="FILE_PATH")
bpy.types.World.arm_play_active_scene = BoolProperty(name="Play Active Scene", description="Load currently edited scene when launching player", default=True)
bpy.types.World.arm_project_scene = StringProperty(name="Scene", description="Scene to load when launching player")
bpy.types.World.arm_physics = EnumProperty(

View file

@ -458,6 +458,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_khamake', bpy.data, 'texts', 'Khamake')
layout.prop(wrd, 'arm_project_root')
layout.label('Armory v' + wrd.arm_version)

View file

@ -46,9 +46,13 @@ def build_dir():
return 'build_' + safestr(blend_name())
def get_fp():
s = bpy.data.filepath.split(os.path.sep)
s.pop()
return os.path.sep.join(s)
wrd = bpy.data.worlds['Arm']
if wrd.arm_project_root != '':
return bpy.path.abspath(wrd.arm_project_root)
else:
s = bpy.data.filepath.split(os.path.sep)
s.pop()
return os.path.sep.join(s)
def get_fp_build():
return get_fp() + '/' + build_dir()