Move py sources to arm package
This commit is contained in:
parent
8dd6d66e45
commit
0fc938911c
|
@ -1,7 +1,7 @@
|
|||
import armutils
|
||||
import shutil
|
||||
import os
|
||||
import bpy
|
||||
import arm.utils
|
||||
|
||||
assets = []
|
||||
khafile_defs = []
|
||||
|
@ -75,7 +75,7 @@ def invalidate_shader_cache(self, context):
|
|||
global invalidate_enabled
|
||||
if invalidate_enabled == False:
|
||||
return
|
||||
fp = armutils.get_fp()
|
||||
fp = arm.utils.get_fp()
|
||||
if os.path.isdir(fp + '/build/compiled/Shaders'):
|
||||
shutil.rmtree(fp + '/build/compiled/Shaders')
|
||||
if os.path.isdir(fp + '/build/compiled/ShaderRaws'):
|
||||
|
@ -85,18 +85,18 @@ def invalidate_compiled_data(self, context):
|
|||
global invalidate_enabled
|
||||
if invalidate_enabled == False:
|
||||
return
|
||||
fp = armutils.get_fp()
|
||||
fp = arm.utils.get_fp()
|
||||
if os.path.isdir(fp + '/build/compiled/Assets'):
|
||||
shutil.rmtree(fp + '/build/compiled/Assets')
|
||||
if os.path.isdir(fp + '/build/compiled/Shaders'):
|
||||
shutil.rmtree(fp + '/build/compiled/Shaders')
|
||||
|
||||
def invalidate_mesh_data(self, context):
|
||||
fp = armutils.get_fp()
|
||||
fp = arm.utils.get_fp()
|
||||
if os.path.isdir(fp + '/build/compiled/Assets/meshes'):
|
||||
shutil.rmtree(fp + '/build/compiled/Assets/meshes')
|
||||
|
||||
def invalidate_envmap_data(self, context):
|
||||
fp = armutils.get_fp()
|
||||
fp = arm.utils.get_fp()
|
||||
if os.path.isdir(fp + '/build/compiled/Assets/envmaps'):
|
||||
shutil.rmtree(fp + '/build/compiled/Assets/envmaps')
|
|
@ -1,6 +1,6 @@
|
|||
# Translating operators from/to Armory player
|
||||
import bpy
|
||||
import armutils
|
||||
import arm.utils
|
||||
try:
|
||||
import barmory
|
||||
except ImportError:
|
||||
|
@ -23,7 +23,7 @@ def parse_operator(text):
|
|||
bpy.context.scene.objects.active = bpy.context.scene.objects[cmd[2]]
|
||||
elif cmd[1] == 'render':
|
||||
import numpy
|
||||
data = numpy.fromfile(armutils.get_fp() + '/build/html5/render.bin', dtype=numpy.uint8)
|
||||
data = numpy.fromfile(arm.utils.get_fp() + '/build/html5/render.bin', dtype=numpy.uint8)
|
||||
data = data.astype(float)
|
||||
data = numpy.divide(data, 255)
|
||||
image = bpy.data.images.new("Render Result", width=int(cmd[2]), height=int(cmd[3]))
|
||||
|
@ -32,7 +32,7 @@ def parse_operator(text):
|
|||
|
||||
def send_operator(op):
|
||||
# Try to translate operator directly to armory
|
||||
if armutils.with_krom() and hasattr(bpy.context, 'object') and bpy.context.object != None:
|
||||
if arm.utils.with_krom() and hasattr(bpy.context, 'object') and bpy.context.object != None:
|
||||
objname = bpy.context.object.name
|
||||
if op.name == 'Translate':
|
||||
vec = bpy.context.object.location
|
|
@ -16,17 +16,17 @@ import math
|
|||
from mathutils import *
|
||||
import time
|
||||
import ast
|
||||
import write_probes
|
||||
import assets
|
||||
import armutils
|
||||
import subprocess
|
||||
import log
|
||||
import armmaterial.make as make_material
|
||||
import armmaterial.mat_batch as mat_batch
|
||||
import armmaterial.texture as make_texture
|
||||
import nodes
|
||||
import make_renderer
|
||||
import make_renderpath
|
||||
import arm.utils
|
||||
import arm.write_probes as write_probes
|
||||
import arm.assets as assets
|
||||
import arm.log as log
|
||||
import arm.material.make as make_material
|
||||
import arm.material.mat_batch as mat_batch
|
||||
import arm.material.texture as make_texture
|
||||
import arm.nodes as nodes
|
||||
import arm.make_renderer as make_renderer
|
||||
import arm.make_renderpath as make_renderpath
|
||||
|
||||
NodeTypeNode = 0
|
||||
NodeTypeBone = 1
|
||||
|
@ -1158,7 +1158,7 @@ class ArmoryExporter:
|
|||
return s
|
||||
|
||||
def use_default_material(self, bobject, o):
|
||||
if bobject.find_armature() and armutils.is_bone_animation_enabled(bobject):
|
||||
if bobject.find_armature() and arm.utils.is_bone_animation_enabled(bobject):
|
||||
o['material_refs'].append('armdefaultskin')
|
||||
self.defaultSkinMaterialObjects.append(bobject)
|
||||
else:
|
||||
|
@ -1286,7 +1286,7 @@ class ArmoryExporter:
|
|||
|
||||
# Remove unsafe chars from data names
|
||||
if objref != None:
|
||||
safe = armutils.safefilename(objref.name)
|
||||
safe = arm.utils.safefilename(objref.name)
|
||||
if objref.name != safe:
|
||||
objref.name = safe
|
||||
|
||||
|
@ -1298,7 +1298,7 @@ class ArmoryExporter:
|
|||
else:
|
||||
self.meshArray[objref]["objectTable"].append(bobject)
|
||||
|
||||
oid = armutils.safe_filename(self.meshArray[objref]["structName"])
|
||||
oid = arm.utils.safe_filename(self.meshArray[objref]["structName"])
|
||||
if ArmoryExporter.option_mesh_per_file:
|
||||
ext = ''
|
||||
if self.is_compress(objref):
|
||||
|
@ -1396,7 +1396,7 @@ class ArmoryExporter:
|
|||
|
||||
if bdata and action != None:
|
||||
armatureid = self.asset_name(bdata)
|
||||
armatureid = armutils.safe_filename(armatureid)
|
||||
armatureid = arm.utils.safe_filename(armatureid)
|
||||
ext = ''
|
||||
if self.is_compress(bdata):
|
||||
ext = '.zip'
|
||||
|
@ -1429,7 +1429,7 @@ class ArmoryExporter:
|
|||
# Save bones separately
|
||||
bones_obj = {}
|
||||
bones_obj['objects'] = bones
|
||||
armutils.write_arm(fp, bones_obj)
|
||||
arm.utils.write_arm(fp, bones_obj)
|
||||
bobject.animation_data.action = orig_action
|
||||
bdata.data_cached = True
|
||||
|
||||
|
@ -1624,7 +1624,7 @@ class ArmoryExporter:
|
|||
if ArmoryExporter.option_mesh_per_file:
|
||||
mesh_obj = {}
|
||||
mesh_obj['mesh_datas'] = [o]
|
||||
armutils.write_arm(fp, mesh_obj)
|
||||
arm.utils.write_arm(fp, mesh_obj)
|
||||
|
||||
bobject.data.mesh_cached = True
|
||||
if bobject.type != 'FONT' and bobject.type != 'META':
|
||||
|
@ -1754,7 +1754,7 @@ class ArmoryExporter:
|
|||
def do_export_mesh(self, objectRef, scene):
|
||||
# This function exports a single mesh object
|
||||
bobject = objectRef[1]["objectTable"][0]
|
||||
oid = armutils.safe_filename(objectRef[1]["structName"])
|
||||
oid = arm.utils.safe_filename(objectRef[1]["structName"])
|
||||
|
||||
# Check if mesh is using instanced rendering
|
||||
is_instanced, instance_offsets = self.object_process_instancing(bobject, objectRef[1]["objectTable"])
|
||||
|
@ -2168,7 +2168,7 @@ class ArmoryExporter:
|
|||
if objref.sound:
|
||||
# Packed
|
||||
if objref.sound.packed_file != None:
|
||||
unpack_path = armutils.get_fp() + '/build/compiled/Assets/unpacked'
|
||||
unpack_path = arm.utils.get_fp() + '/build/compiled/Assets/unpacked'
|
||||
if not os.path.exists(unpack_path):
|
||||
os.makedirs(unpack_path)
|
||||
unpack_filepath = unpack_path + '/' + objref.sound.name
|
||||
|
@ -2178,10 +2178,10 @@ class ArmoryExporter:
|
|||
assets.add(unpack_filepath)
|
||||
# External
|
||||
else:
|
||||
assets.add(armutils.safe_assetpath(objref.sound.filepath)) # Link sound to assets
|
||||
assets.add(arm.utils.safe_assetpath(objref.sound.filepath)) # Link sound to assets
|
||||
|
||||
o['sound'] = armutils.extract_filename(objref.sound.filepath)
|
||||
o['sound'] = armutils.safe_filename(o['sound'])
|
||||
o['sound'] = arm.utils.extract_filename(objref.sound.filepath)
|
||||
o['sound'] = arm.utils.safe_filename(o['sound'])
|
||||
else:
|
||||
o['sound'] = ''
|
||||
o['muted'] = objref.muted
|
||||
|
@ -2313,7 +2313,7 @@ class ArmoryExporter:
|
|||
# No shader invalidate required?
|
||||
make_renderer.make_renderer(cam)
|
||||
# Rebuild modified path
|
||||
assets_path = armutils.get_sdk_path() + 'armory/Assets/'
|
||||
assets_path = arm.utils.get_sdk_path() + 'armory/Assets/'
|
||||
make_renderpath.build_node_trees(assets_path)
|
||||
|
||||
def export_particle_systems(self):
|
||||
|
@ -2368,7 +2368,7 @@ class ArmoryExporter:
|
|||
gpo = self.post_export_grease_pencil(gpRef)
|
||||
gp_obj = {}
|
||||
gp_obj['grease_pencil_datas'] = [gpo]
|
||||
armutils.write_arm(fp, gp_obj)
|
||||
arm.utils.write_arm(fp, gp_obj)
|
||||
gpRef.data_cached = True
|
||||
|
||||
def is_compress(self, obj):
|
||||
|
@ -2433,7 +2433,7 @@ class ArmoryExporter:
|
|||
|
||||
self.process_skinned_meshes()
|
||||
|
||||
self.output['name'] = armutils.safe_filename(self.scene.name)
|
||||
self.output['name'] = arm.utils.safe_filename(self.scene.name)
|
||||
if (self.filepath.endswith('.zip')):
|
||||
self.output['name'] += '.zip'
|
||||
|
||||
|
@ -2456,7 +2456,7 @@ class ArmoryExporter:
|
|||
if self.scene.camera != None:
|
||||
self.output['camera_ref'] = self.scene.camera.name
|
||||
else:
|
||||
if armutils.safe_filename(self.scene.name) == armutils.get_project_scene_name():
|
||||
if arm.utils.safe_filename(self.scene.name) == arm.utils.get_project_scene_name():
|
||||
print('Armory Warning: No camera found in active scene')
|
||||
|
||||
self.output['material_datas'] = []
|
||||
|
@ -2524,7 +2524,7 @@ class ArmoryExporter:
|
|||
self.output['embedded_datas'].append(file)
|
||||
|
||||
# Write scene file
|
||||
armutils.write_arm(self.filepath, self.output)
|
||||
arm.utils.write_arm(self.filepath, self.output)
|
||||
|
||||
print('Scene built in ' + str(time.time() - profile_time))
|
||||
return {'FINISHED'}
|
||||
|
@ -2655,7 +2655,7 @@ class ArmoryExporter:
|
|||
|
||||
def post_export_object(self, bobject, o, type):
|
||||
# Animation setup
|
||||
if armutils.is_bone_animation_enabled(bobject) or armutils.is_object_animation_enabled(bobject):
|
||||
if arm.utils.is_bone_animation_enabled(bobject) or arm.utils.is_object_animation_enabled(bobject):
|
||||
x = {}
|
||||
if len(bobject.my_cliptraitlist) > 0:
|
||||
# Edit clips enabled
|
||||
|
@ -2680,7 +2680,7 @@ class ArmoryExporter:
|
|||
x['max_bones'] = bpy.data.worlds['Arm'].generate_gpu_skin_max_bones
|
||||
else:
|
||||
# Export default clip, taking full action
|
||||
if armutils.is_bone_animation_enabled(bobject):
|
||||
if arm.utils.is_bone_animation_enabled(bobject):
|
||||
begin_frame, end_frame = self.get_action_framerange(bobject.parent.animation_data.action)
|
||||
else:
|
||||
begin_frame, end_frame = self.get_action_framerange(bobject.animation_data.action)
|
||||
|
@ -2702,13 +2702,13 @@ class ArmoryExporter:
|
|||
x = {}
|
||||
if t.type_prop == 'Logic Nodes' and t.nodes_name_prop != '':
|
||||
x['type'] = 'Script'
|
||||
x['class_name'] = bpy.data.worlds['Arm'].arm_project_package + '.node.' + armutils.safe_source_name(t.nodes_name_prop)
|
||||
x['class_name'] = bpy.data.worlds['Arm'].arm_project_package + '.node.' + arm.utils.safe_source_name(t.nodes_name_prop)
|
||||
elif t.type_prop == 'JS Script' or t.type_prop == 'Python Script':
|
||||
basename = t.jsscript_prop.split('.')[0]
|
||||
x['type'] = 'Script'
|
||||
x['class_name'] = 'armory.trait.internal.JSScript'
|
||||
x['parameters'] = [armutils.safe_filename(basename)]
|
||||
scriptspath = armutils.get_fp() + '/build/compiled/scripts/'
|
||||
x['parameters'] = [arm.utils.safe_filename(basename)]
|
||||
scriptspath = arm.utils.get_fp() + '/build/compiled/scripts/'
|
||||
if not os.path.exists(scriptspath):
|
||||
os.makedirs(scriptspath)
|
||||
# Compile to JS
|
||||
|
@ -2718,7 +2718,7 @@ class ArmoryExporter:
|
|||
targetpath = scriptspath + basename_ext
|
||||
with open(targetpath, 'w') as f:
|
||||
f.write(bpy.data.texts[t.jsscript_prop].as_string())
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
python_path = bpy.app.binary_path_python
|
||||
cwd = os.getcwd()
|
||||
os.chdir(scriptspath)
|
||||
|
@ -2733,7 +2733,7 @@ class ArmoryExporter:
|
|||
else:
|
||||
# Write js to file
|
||||
assetpath = 'build/compiled/scripts/' + t.jsscript_prop + '.js'
|
||||
targetpath = armutils.get_fp() + '/' + assetpath
|
||||
targetpath = arm.utils.get_fp() + '/' + assetpath
|
||||
with open(targetpath, 'w') as f:
|
||||
f.write(bpy.data.texts[t.jsscript_prop].as_string())
|
||||
assets.add(assetpath)
|
||||
|
@ -2746,7 +2746,7 @@ class ArmoryExporter:
|
|||
# TODO: temporary, export single mesh navmesh as obj
|
||||
if t.class_name_prop == 'NavMesh' and bobject.type == 'MESH' and bpy.data.worlds['Arm'].arm_navigation != 'Disabled':
|
||||
ArmoryExporter.export_navigation = True
|
||||
nav_path = armutils.get_fp() + '/build/compiled/Assets/navigation'
|
||||
nav_path = arm.utils.get_fp() + '/build/compiled/Assets/navigation'
|
||||
if not os.path.exists(nav_path):
|
||||
os.makedirs(nav_path)
|
||||
nav_filepath = nav_path + '/nav_' + bobject.data.name + '.arm'
|
||||
|
@ -2896,9 +2896,9 @@ class ArmoryExporter:
|
|||
if '_LDR' in defs: # No compositor used
|
||||
for i in range(0, 3):
|
||||
bgcol[i] = pow(bgcol[i], 1.0 / 2.2)
|
||||
o['background_color'] = armutils.color_to_int(bgcol)
|
||||
o['background_color'] = arm.utils.color_to_int(bgcol)
|
||||
|
||||
wmat_name = armutils.safe_filename(world.name) + '_material'
|
||||
wmat_name = arm.utils.safe_filename(world.name) + '_material'
|
||||
o['material_ref'] = wmat_name + '/' + wmat_name + '/world'
|
||||
o['probes'] = []
|
||||
# Main probe
|
|
@ -1,16 +1,16 @@
|
|||
import bpy
|
||||
import armutils
|
||||
import make
|
||||
import make_state as state
|
||||
import space_armory
|
||||
import nodes_renderpath
|
||||
import time
|
||||
import bridge
|
||||
import log
|
||||
import props
|
||||
import os
|
||||
import sys
|
||||
from bpy.app.handlers import persistent
|
||||
import arm.utils
|
||||
import arm.bridge as bridge
|
||||
import arm.log as log
|
||||
import arm.props as props
|
||||
import arm.make as make
|
||||
import arm.make_state as state
|
||||
import arm.space_armory as space_armory
|
||||
import arm.make_renderer as make_renderer
|
||||
try:
|
||||
import barmory
|
||||
except ImportError:
|
||||
|
@ -111,7 +111,7 @@ def on_scene_update_post(context):
|
|||
if state.krom_running:
|
||||
barmory.call_js('armory.Scene.patch();')
|
||||
# Or switch to armory space
|
||||
elif armutils.with_krom() and state.in_viewport:
|
||||
elif arm.utils.with_krom() and state.in_viewport:
|
||||
state.play_area.type = 'VIEW_ARMORY'
|
||||
# Prevent immediate operator patch
|
||||
if len(ops) > 0:
|
||||
|
@ -152,7 +152,7 @@ def on_load_post(context):
|
|||
global appended_py_paths
|
||||
|
||||
props.init_properties_on_load()
|
||||
nodes_renderpath.reload_blend_data()
|
||||
make_renderer.reload_blend_data()
|
||||
|
||||
# Check for blender.py scripts in enabled libraries
|
||||
# for fp in appended_py_paths:
|
||||
|
@ -162,7 +162,7 @@ def on_load_post(context):
|
|||
wrd = bpy.data.worlds['Arm']
|
||||
for lib in wrd.my_librarytraitlist:
|
||||
if lib.enabled_prop:
|
||||
fp = armutils.get_fp() + '/Libraries/' + lib.name
|
||||
fp = arm.utils.get_fp() + '/Libraries/' + lib.name
|
||||
if fp not in appended_py_paths and os.path.exists(fp + '/blender.py'):
|
||||
# if os.path.exists(fp + '/blender.py'):
|
||||
sys.path.append(fp)
|
||||
|
@ -179,7 +179,7 @@ def register():
|
|||
bpy.app.handlers.save_pre.append(on_save_pre)
|
||||
bpy.app.handlers.load_post.append(on_load_post)
|
||||
# On windows, on_load_post is not called when opening .blend file from explorer
|
||||
if armutils.get_os() == 'win' and armutils.get_fp() != '':
|
||||
if arm.utils.get_os() == 'win' and arm.utils.get_fp() != '':
|
||||
on_load_post(None)
|
||||
|
||||
def unregister():
|
|
@ -1,7 +1,7 @@
|
|||
# Key shortcuts
|
||||
import bpy
|
||||
import props_ui
|
||||
import armutils
|
||||
import arm.props_ui as props_ui
|
||||
import arm.utils
|
||||
|
||||
arm_keymaps = []
|
||||
|
||||
|
@ -9,7 +9,7 @@ def register():
|
|||
wm = bpy.context.window_manager
|
||||
km = wm.keyconfigs.addon.keymaps.new(name='Window', space_type='EMPTY', region_type="WINDOW")
|
||||
km.keymap_items.new(props_ui.ArmoryPlayButton.bl_idname, type='F5', value='PRESS')
|
||||
if armutils.with_krom():
|
||||
if arm.utils.with_krom():
|
||||
km.keymap_items.new(props_ui.ArmoryPlayInViewportButton.bl_idname, type='P', value='PRESS')
|
||||
else:
|
||||
km.keymap_items.new(props_ui.ArmoryPlayButton.bl_idname, type='P', value='PRESS')
|
|
@ -1,5 +1,5 @@
|
|||
import os
|
||||
import armutils
|
||||
import arm.utils
|
||||
|
||||
def write_data(res, defs, json_data, base_name):
|
||||
# Define
|
||||
|
@ -274,7 +274,7 @@ def save_data(path, base_name, subset, res):
|
|||
|
||||
r = {}
|
||||
r['shader_datas'] = [res['shader_datas'][-1]]
|
||||
armutils.write_arm(path + '/' + res_name + '.arm', r)
|
||||
arm.utils.write_arm(path + '/' + res_name + '.arm', r)
|
||||
|
||||
def make(base_name, json_data, fp, defs):
|
||||
|
|
@ -1,16 +1,18 @@
|
|||
import props_ui
|
||||
import space_armory
|
||||
import armutils
|
||||
import bridge
|
||||
import make_state as state
|
||||
import arm.utils
|
||||
import arm.bridge as bridge
|
||||
import arm.make_state as state
|
||||
|
||||
progress = 100.0
|
||||
tag_redraw = False
|
||||
info_text = ''
|
||||
header_info_text = ''
|
||||
|
||||
def clear():
|
||||
props_ui.ArmoryProjectPanel.info_text = ''
|
||||
if armutils.with_krom():
|
||||
space_armory.ArmorySpaceHeader.info_text = ''
|
||||
global info_text
|
||||
global header_info_text
|
||||
info_text = ''
|
||||
if arm.utils.with_krom():
|
||||
header_info_text = ''
|
||||
|
||||
def format_text(text):
|
||||
return (text[:80] + '..') if len(text) > 80 else text # Limit str size
|
||||
|
@ -24,13 +26,15 @@ def electron_trace(text):
|
|||
|
||||
def print_info(text):
|
||||
global tag_redraw
|
||||
global info_text
|
||||
print(text)
|
||||
props_ui.ArmoryProjectPanel.info_text = format_text(text)
|
||||
info_text = format_text(text)
|
||||
tag_redraw = True
|
||||
|
||||
def print_player(text):
|
||||
global header_info_text
|
||||
if state.krom_running:
|
||||
space_armory.ArmorySpaceHeader.info_text = format_text(text)
|
||||
header_info_text = format_text(text)
|
||||
|
||||
def print_progress(value):
|
||||
global progress
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class InitNode(Node, ArmLogicTreeNode):
|
||||
'''Init node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class UpdateNode(Node, ArmLogicTreeNode):
|
||||
'''Update node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class SetTransformNode(Node, ArmLogicTreeNode):
|
||||
'''Set transform node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class SetVisibleNode(Node, ArmLogicTreeNode):
|
||||
'''Set visible node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class BoolNode(Node, ArmLogicTreeNode):
|
||||
'''Bool node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class FloatNode(Node, ArmLogicTreeNode):
|
||||
'''Float node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class SelfNode(Node, ArmLogicTreeNode):
|
||||
'''Self node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class TimeNode(Node, ArmLogicTreeNode):
|
||||
'''Time node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class TransformNode(Node, ArmLogicTreeNode):
|
||||
'''Transform node'''
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from bpy.types import Node, NodeSocket
|
||||
from logicnode.arm_nodes import *
|
||||
from arm.logicnode.arm_nodes import *
|
||||
|
||||
class VectorNode(Node, ArmLogicTreeNode):
|
||||
'''Vector node'''
|
|
@ -8,27 +8,27 @@ from bpy.props import *
|
|||
import subprocess
|
||||
import threading
|
||||
import webbrowser
|
||||
import write_data
|
||||
import make_logic
|
||||
import make_renderpath
|
||||
import make_world
|
||||
import make_utils
|
||||
import make_state as state
|
||||
import path_tracer
|
||||
from exporter import ArmoryExporter
|
||||
import armutils
|
||||
import assets
|
||||
import log
|
||||
import armlib.make_datas
|
||||
import armlib.make_variants
|
||||
import armlib.server
|
||||
import arm.utils
|
||||
import arm.write_data as write_data
|
||||
import arm.make_logic as make_logic
|
||||
import arm.make_renderpath as make_renderpath
|
||||
import arm.make_world as make_world
|
||||
import arm.make_utils as make_utils
|
||||
import arm.make_state as state
|
||||
import arm.path_tracer as path_tracer
|
||||
import arm.assets as assets
|
||||
import arm.log as log
|
||||
import arm.lib.make_datas
|
||||
import arm.lib.make_variants
|
||||
import arm.lib.server
|
||||
from arm.exporter import ArmoryExporter
|
||||
|
||||
exporter = ArmoryExporter()
|
||||
scripts_mtime = 0 # Monitor source changes
|
||||
|
||||
def compile_shader(raw_shaders_path, shader_name, defs):
|
||||
os.chdir(raw_shaders_path + './' + shader_name)
|
||||
fp = armutils.get_fp()
|
||||
fp = arm.utils.get_fp()
|
||||
|
||||
# Open json file
|
||||
json_name = shader_name + '.json'
|
||||
|
@ -37,8 +37,8 @@ def compile_shader(raw_shaders_path, shader_name, defs):
|
|||
json_file = f.read()
|
||||
json_data = json.loads(json_file)
|
||||
|
||||
armlib.make_datas.make(base_name, json_data, fp, defs)
|
||||
armlib.make_variants.make(base_name, json_data, fp, defs)
|
||||
arm.lib.make_datas.make(base_name, json_data, fp, defs)
|
||||
arm.lib.make_variants.make(base_name, json_data, fp, defs)
|
||||
|
||||
def export_data(fp, sdk_path, is_play=False, is_publish=False, in_viewport=False):
|
||||
global exporter
|
||||
|
@ -86,7 +86,7 @@ def export_data(fp, sdk_path, is_play=False, is_publish=False, in_viewport=False
|
|||
for scene in bpy.data.scenes:
|
||||
if scene.game_export:
|
||||
ext = '.zip' if (scene.data_compressed and is_publish) else '.arm'
|
||||
asset_path = 'build/compiled/Assets/' + armutils.safe_filename(scene.name) + ext
|
||||
asset_path = 'build/compiled/Assets/' + arm.utils.safe_filename(scene.name) + ext
|
||||
exporter.execute(bpy.context, asset_path)
|
||||
if physics_found == False and ArmoryExporter.export_physics:
|
||||
physics_found = True
|
||||
|
@ -135,24 +135,24 @@ def compile_project(target_name=None, is_publish=False, watch=False, patch=False
|
|||
elif target_name == 'native':
|
||||
target_name = ''
|
||||
|
||||
node_path = armutils.get_node_path()
|
||||
khamake_path = armutils.get_khamake_path()
|
||||
node_path = arm.utils.get_node_path()
|
||||
khamake_path = arm.utils.get_khamake_path()
|
||||
|
||||
kha_target_name = make_utils.get_kha_target(target_name)
|
||||
cmd = [node_path, khamake_path, kha_target_name]
|
||||
|
||||
ffmpeg_path = armutils.get_ffmpeg_path() # Path to binary
|
||||
ffmpeg_path = arm.utils.get_ffmpeg_path() # Path to binary
|
||||
if ffmpeg_path != '':
|
||||
cmd.append('--ffmpeg')
|
||||
cmd.append(ffmpeg_path) # '"' + ffmpeg_path + '"'
|
||||
|
||||
if target_name == '' or target_name == '--run':
|
||||
cmd.append('-g')
|
||||
cmd.append(getattr(wrd, 'arm_gapi_' + armutils.get_os()))
|
||||
cmd.append(getattr(wrd, 'arm_gapi_' + arm.utils.get_os()))
|
||||
|
||||
if kha_target_name == 'krom':
|
||||
if state.in_viewport:
|
||||
if armutils.glsl_version() >= 330:
|
||||
if arm.utils.glsl_version() >= 330:
|
||||
cmd.append('--shaderversion')
|
||||
cmd.append('330')
|
||||
else:
|
||||
|
@ -202,7 +202,7 @@ def build_project(is_play=False, is_publish=False, in_viewport=False, target=Non
|
|||
state.in_viewport = False
|
||||
|
||||
# Save blend
|
||||
if armutils.get_save_on_build():
|
||||
if arm.utils.get_save_on_build():
|
||||
bpy.ops.wm.save_mainfile()
|
||||
|
||||
log.clear()
|
||||
|
@ -216,11 +216,11 @@ def build_project(is_play=False, is_publish=False, in_viewport=False, target=Non
|
|||
break
|
||||
|
||||
# Get paths
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
raw_shaders_path = sdk_path + '/armory/Shaders/'
|
||||
|
||||
# Set dir
|
||||
fp = armutils.get_fp()
|
||||
fp = arm.utils.get_fp()
|
||||
os.chdir(fp)
|
||||
|
||||
# Create directories
|
||||
|
@ -328,8 +328,10 @@ def play_project(in_viewport):
|
|||
global scripts_mtime
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
log.clear()
|
||||
|
||||
# Store area
|
||||
if armutils.with_krom() and in_viewport and bpy.context.area != None and bpy.context.area.type == 'VIEW_3D':
|
||||
if arm.utils.with_krom() and in_viewport and bpy.context.area != None and bpy.context.area.type == 'VIEW_3D':
|
||||
state.play_area = bpy.context.area
|
||||
|
||||
state.target = runtime_to_target(in_viewport)
|
||||
|
@ -353,7 +355,7 @@ def play_project(in_viewport):
|
|||
state.last_in_viewport = state.in_viewport
|
||||
|
||||
# Trait sources modified
|
||||
script_path = armutils.get_fp() + '/Sources/' + wrd.arm_project_package
|
||||
script_path = arm.utils.get_fp() + '/Sources/' + wrd.arm_project_package
|
||||
if os.path.isdir(script_path):
|
||||
for fn in glob.iglob(os.path.join(script_path, '**', '*.hx'), recursive=True):
|
||||
mtime = os.path.getmtime(fn)
|
||||
|
@ -378,7 +380,7 @@ def play_project(in_viewport):
|
|||
mode = 'play_viewport'
|
||||
state.compileproc = compile_project(target_name='krom')
|
||||
else: # Electron, Browser
|
||||
w, h = armutils.get_render_resolution(armutils.get_active_scene())
|
||||
w, h = arm.utils.get_render_resolution(arm.utils.get_active_scene())
|
||||
write_data.write_electronjs(w, h)
|
||||
write_data.write_indexhtml(w, h)
|
||||
state.compileproc = compile_project(target_name='html5')
|
||||
|
@ -388,14 +390,14 @@ def play_project(in_viewport):
|
|||
|
||||
def on_compiled(mode): # build, play, play_viewport, publish
|
||||
log.clear()
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
# Print info
|
||||
if mode == 'publish':
|
||||
target_name = make_utils.get_kha_target(wrd.arm_project_target)
|
||||
print('Project published')
|
||||
files_path = armutils.get_fp() + '/build/' + target_name
|
||||
files_path = arm.utils.get_fp() + '/build/' + target_name
|
||||
if target_name == 'html5':
|
||||
print('HTML5 files are located in ' + files_path)
|
||||
elif target_name == 'ios' or target_name == 'osx': # TODO: to macos
|
||||
|
@ -413,9 +415,9 @@ def on_compiled(mode): # build, play, play_viewport, publish
|
|||
if wrd.arm_play_runtime == 'Electron':
|
||||
electron_app_path = './build/electron.js'
|
||||
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
electron_path = sdk_path + 'win32/Kode Studio.exe'
|
||||
elif armutils.get_os() == 'mac':
|
||||
elif arm.utils.get_os() == 'mac':
|
||||
electron_path = sdk_path + 'Kode Studio.app/Contents/MacOS/Electron'
|
||||
else:
|
||||
electron_path = sdk_path + 'linux64/kodestudio'
|
||||
|
@ -424,28 +426,28 @@ def on_compiled(mode): # build, play, play_viewport, publish
|
|||
watch_play()
|
||||
elif wrd.arm_play_runtime == 'Browser':
|
||||
# Start server
|
||||
os.chdir(armutils.get_fp())
|
||||
t = threading.Thread(name='localserver', target=armlib.server.run)
|
||||
os.chdir(arm.utils.get_fp())
|
||||
t = threading.Thread(name='localserver', target=arm.lib.server.run)
|
||||
t.daemon = True
|
||||
t.start()
|
||||
html5_app_path = 'http://localhost:8040/build/html5'
|
||||
webbrowser.open(html5_app_path)
|
||||
elif wrd.arm_play_runtime == 'Krom':
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
krom_location = sdk_path + '/win32/Krom/win32'
|
||||
krom_path = krom_location + '/Krom.exe'
|
||||
elif armutils.get_os() == 'mac':
|
||||
elif arm.utils.get_os() == 'mac':
|
||||
krom_location = sdk_path + '/Kode Studio.app/Contents/Krom/macos/Krom.app/Contents/MacOS'
|
||||
krom_path = krom_location + '/Krom'
|
||||
else:
|
||||
krom_location = sdk_path + '/linux64/Krom/linux'
|
||||
krom_path = krom_location + '/Krom'
|
||||
os.chdir(krom_location)
|
||||
state.playproc = subprocess.Popen([krom_path, armutils.get_fp() + '/build/window/krom', armutils.get_fp() + '/build/window/krom-resources'], stderr=subprocess.PIPE)
|
||||
state.playproc = subprocess.Popen([krom_path, arm.utils.get_fp() + '/build/window/krom', arm.utils.get_fp() + '/build/window/krom-resources'], stderr=subprocess.PIPE)
|
||||
watch_play()
|
||||
|
||||
def clean_cache():
|
||||
os.chdir(armutils.get_fp())
|
||||
os.chdir(arm.utils.get_fp())
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
# Preserve envmaps
|
||||
|
@ -467,7 +469,7 @@ def clean_cache():
|
|||
mat.signature = ''
|
||||
|
||||
def clean_project():
|
||||
os.chdir(armutils.get_fp())
|
||||
os.chdir(arm.utils.get_fp())
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
# Remove build and compiled data
|
||||
|
@ -506,5 +508,5 @@ def publish_project():
|
|||
assets.invalidate_enabled = True
|
||||
|
||||
def get_render_result():
|
||||
with open(armutils.get_fp() + '/build/html5/render.msg', 'w') as f:
|
||||
with open(arm.utils.get_fp() + '/build/html5/render.msg', 'w') as f:
|
||||
pass
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
from bpy.types import NodeTree, Node, NodeSocket
|
||||
from bpy.props import *
|
||||
import nodes
|
||||
import arm.nodes as nodes
|
||||
|
||||
def parse_defs(node_group):
|
||||
rn = nodes.get_node_by_type(node_group, 'COMPOSITE')
|
|
@ -3,9 +3,9 @@ from bpy.types import NodeTree, Node, NodeSocket
|
|||
from bpy.props import *
|
||||
import os
|
||||
import sys
|
||||
import nodes_logic
|
||||
import nodes
|
||||
import armutils
|
||||
import arm.nodes_logic as nodes_logic
|
||||
import arm.nodes as nodes
|
||||
import arm.utils
|
||||
|
||||
# Generating node sources
|
||||
def build_node_trees():
|
||||
|
@ -27,7 +27,7 @@ def build_node_trees():
|
|||
|
||||
def build_node_tree(node_group):
|
||||
path = 'Sources/' + bpy.data.worlds['Arm'].arm_project_package.replace('.', '/') + '/node/'
|
||||
node_group_name = armutils.safe_source_name(node_group.name)
|
||||
node_group_name = arm.utils.safe_source_name(node_group.name)
|
||||
|
||||
with open(path + node_group_name + '.hx', 'w') as f:
|
||||
f.write('package ' + bpy.data.worlds['Arm'].arm_project_package + '.node;\n\n')
|
|
@ -1,5 +1,6 @@
|
|||
import bpy
|
||||
import nodes_renderpath
|
||||
import arm.nodes_renderpath as nodes_renderpath
|
||||
import arm.utils
|
||||
|
||||
group = None
|
||||
nodes = None
|
||||
|
@ -11,13 +12,13 @@ def make_renderer(cam):
|
|||
global links
|
||||
|
||||
if cam.rp_renderer == 'Forward':
|
||||
nodes_renderpath.load_library('forward_path', 'armory_default')
|
||||
load_library('forward_path', 'armory_default')
|
||||
group = bpy.data.node_groups['armory_default']
|
||||
nodes = group.nodes
|
||||
links = group.links
|
||||
make_forward(cam)
|
||||
else: # Deferred
|
||||
nodes_renderpath.load_library('deferred_path', 'armory_default')
|
||||
load_library('deferred_path', 'armory_default')
|
||||
group = bpy.data.node_groups['armory_default']
|
||||
nodes = group.nodes
|
||||
links = group.links
|
||||
|
@ -153,3 +154,38 @@ def make_deferred(cam):
|
|||
l = nodes['Draw Compositor'].outputs[0].links[0]
|
||||
links.remove(l)
|
||||
links.new(nodes['Framebuffer'].outputs[0], nodes['Draw Compositor'].inputs[1])
|
||||
|
||||
# Handling node data
|
||||
def check_default():
|
||||
if bpy.data.node_groups.get('armory_default') == None and len(bpy.data.cameras) > 0:
|
||||
make_renderer(bpy.data.cameras[0])
|
||||
|
||||
def reload_blend_data():
|
||||
if bpy.data.node_groups.get('Armory PBR') == None:
|
||||
load_library('Armory PBR')
|
||||
check_default()
|
||||
|
||||
def load_library(asset_name, rename=None):
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
data_path = sdk_path + '/armory/blender/data/data.blend'
|
||||
data_names = [asset_name]
|
||||
|
||||
# Remove old
|
||||
if rename != None and rename in bpy.data.node_groups and asset_name != 'Armory PBR':
|
||||
bpy.data.node_groups.remove(bpy.data.node_groups[rename], do_unlink=True)
|
||||
|
||||
# Import
|
||||
data_refs = data_names.copy()
|
||||
with bpy.data.libraries.load(data_path, link=False) as (data_from, data_to):
|
||||
data_to.node_groups = data_refs
|
||||
|
||||
for ref in data_refs:
|
||||
ref.use_fake_user = True
|
||||
if rename != None:
|
||||
ref.name = rename
|
||||
|
||||
def register():
|
||||
reload_blend_data()
|
||||
|
||||
def unregister():
|
||||
pass
|
|
@ -6,10 +6,10 @@ import sys
|
|||
import json
|
||||
import platform
|
||||
import subprocess
|
||||
import make_compositor
|
||||
import assets
|
||||
import armutils
|
||||
import nodes
|
||||
import arm.make_compositor as make_compositor
|
||||
import arm.assets as assets
|
||||
import arm.utils
|
||||
import arm.nodes as nodes
|
||||
|
||||
def build_node_trees(assets_path):
|
||||
s = bpy.data.filepath.split(os.path.sep)
|
||||
|
@ -62,7 +62,7 @@ def build_node_tree(cam, node_group):
|
|||
buildNode(dat['stages'], rn, node_group)
|
||||
|
||||
asset_path = path + node_group_name + '.arm'
|
||||
armutils.write_arm(asset_path, output)
|
||||
arm.utils.write_arm(asset_path, output)
|
||||
assets.add(asset_path)
|
||||
|
||||
def make_set_target(stage, node_group, node, currentNode=None, target_index=1, viewport_scale=1.0):
|
||||
|
@ -109,7 +109,7 @@ def make_clear_target(stage, color_val=None, depth_val=None, stencil_val=None):
|
|||
if color_val == -1: # Clear to world background color
|
||||
stage['params'].append('-1')
|
||||
else:
|
||||
stage['params'].append(str(armutils.to_hex(color_val)))
|
||||
stage['params'].append(str(arm.utils.to_hex(color_val)))
|
||||
if depth_val != None:
|
||||
stage['params'].append('depth')
|
||||
stage['params'].append(str(depth_val))
|
||||
|
@ -120,7 +120,7 @@ def make_clear_target(stage, color_val=None, depth_val=None, stencil_val=None):
|
|||
def make_clear_image(stage, image_name, color_val):
|
||||
stage['command'] = 'clear_image'
|
||||
stage['params'].append(image_name)
|
||||
stage['params'].append(str(armutils.to_hex(color_val)))
|
||||
stage['params'].append(str(arm.utils.to_hex(color_val)))
|
||||
|
||||
def make_generate_mipmaps(stage, node_group, node):
|
||||
stage['command'] = 'generate_mipmaps'
|
|
@ -1,20 +1,20 @@
|
|||
import armutils
|
||||
import arm.utils
|
||||
import subprocess
|
||||
import bpy
|
||||
|
||||
def kode_studio():
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
project_path = armutils.get_fp()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
project_path = arm.utils.get_fp()
|
||||
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
kode_path = sdk_path + '/win32/Kode Studio.exe'
|
||||
subprocess.Popen([kode_path, armutils.get_fp()])
|
||||
elif armutils.get_os() == 'mac':
|
||||
subprocess.Popen([kode_path, arm.utils.get_fp()])
|
||||
elif arm.utils.get_os() == 'mac':
|
||||
kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"'
|
||||
subprocess.Popen([kode_path + ' ' + armutils.get_fp()], shell=True)
|
||||
subprocess.Popen([kode_path + ' ' + arm.utils.get_fp()], shell=True)
|
||||
else:
|
||||
kode_path = sdk_path + '/linux64/kodestudio'
|
||||
subprocess.Popen([kode_path, armutils.get_fp()])
|
||||
subprocess.Popen([kode_path, arm.utils.get_fp()])
|
||||
|
||||
def def_strings_to_array(strdefs):
|
||||
defs = strdefs.split('_')
|
||||
|
@ -30,7 +30,7 @@ def get_kha_target(target_name): # TODO: remove
|
|||
def runtime_to_gapi():
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
if wrd.arm_play_runtime == 'Krom' or wrd.arm_play_runtime == 'Native':
|
||||
return 'arm_gapi_' + armutils.get_os()
|
||||
return 'arm_gapi_' + arm.utils.get_os()
|
||||
else:
|
||||
return 'arm_gapi_html5'
|
||||
|
||||
|
@ -38,7 +38,7 @@ def target_to_gapi():
|
|||
# TODO: align target names
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
if wrd.arm_project_target == 'krom':
|
||||
return 'arm_gapi_' + armutils.get_os()
|
||||
return 'arm_gapi_' + arm.utils.get_os()
|
||||
elif wrd.arm_project_target == 'macos':
|
||||
return 'arm_gapi_mac'
|
||||
elif wrd.arm_project_target == 'windows':
|
|
@ -3,11 +3,11 @@ from bpy.types import NodeTree, Node, NodeSocket
|
|||
from bpy.props import *
|
||||
import os
|
||||
import json
|
||||
import write_probes
|
||||
import assets
|
||||
import armutils
|
||||
import nodes
|
||||
import log
|
||||
import arm.write_probes as write_probes
|
||||
import arm.assets as assets
|
||||
import arm.utils
|
||||
import arm.nodes as nodes
|
||||
import arm.log as log
|
||||
|
||||
def build_node_trees(active_worlds):
|
||||
s = bpy.data.filepath.split(os.path.sep)
|
||||
|
@ -30,7 +30,7 @@ def build_node_tree(world):
|
|||
output = {}
|
||||
dat = {}
|
||||
output['material_datas'] = [dat]
|
||||
dat['name'] = armutils.safe_filename(world.name) + '_material'
|
||||
dat['name'] = arm.utils.safe_filename(world.name) + '_material'
|
||||
context = {}
|
||||
dat['contexts'] = [context]
|
||||
context['name'] = 'world'
|
||||
|
@ -63,7 +63,7 @@ def build_node_tree(world):
|
|||
# Percentage closer soft shadows
|
||||
if wrd.generate_pcss_state == 'On':
|
||||
wrd.world_defs += '_PCSS'
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
assets.add(sdk_path + 'armory/Assets/noise64.png')
|
||||
assets.add_embedded_data('noise64.png')
|
||||
|
||||
|
@ -121,7 +121,7 @@ def write_output(output):
|
|||
# Write material json
|
||||
path = 'build/compiled/Assets/materials/'
|
||||
asset_path = path + dat['name'] + '.arm'
|
||||
armutils.write_arm(asset_path, output)
|
||||
arm.utils.write_arm(asset_path, output)
|
||||
assets.add(asset_path)
|
||||
|
||||
def parse_world_output(world, node, context):
|
||||
|
@ -163,7 +163,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
image = node.image
|
||||
filepath = image.filepath
|
||||
|
||||
if image.packed_file == None and not os.path.isfile(armutils.safe_assetpath(filepath)):
|
||||
if image.packed_file == None and not os.path.isfile(arm.utils.safe_assetpath(filepath)):
|
||||
log.warn(world.name + ' - unable to open ' + image.filepath)
|
||||
return
|
||||
|
||||
|
@ -174,8 +174,8 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
tex['v_addressing'] = 'clamp'
|
||||
|
||||
# Reference image name
|
||||
tex['file'] = armutils.extract_filename(image.filepath)
|
||||
tex['file'] = armutils.safe_filename(tex['file'])
|
||||
tex['file'] = arm.utils.extract_filename(image.filepath)
|
||||
tex['file'] = arm.utils.safe_filename(tex['file'])
|
||||
base = tex['file'].rsplit('.', 1)
|
||||
ext = base[1].lower()
|
||||
|
||||
|
@ -194,7 +194,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
|
||||
if image.packed_file != None:
|
||||
# Extract packed data
|
||||
unpack_path = armutils.get_fp() + '/build/compiled/Assets/unpacked'
|
||||
unpack_path = arm.utils.get_fp() + '/build/compiled/Assets/unpacked'
|
||||
if not os.path.exists(unpack_path):
|
||||
os.makedirs(unpack_path)
|
||||
unpack_filepath = unpack_path + '/' + tex['file']
|
||||
|
@ -202,7 +202,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
|
||||
if do_convert:
|
||||
if not os.path.isfile(unpack_filepath):
|
||||
armutils.write_image(image, unpack_filepath, file_format=target_format)
|
||||
arm.utils.write_image(image, unpack_filepath, file_format=target_format)
|
||||
|
||||
elif os.path.isfile(unpack_filepath) == False or os.path.getsize(unpack_filepath) != image.packed_file.size:
|
||||
with open(unpack_filepath, 'wb') as f:
|
||||
|
@ -211,15 +211,15 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
assets.add(unpack_filepath)
|
||||
else:
|
||||
if do_convert:
|
||||
converted_path = armutils.get_fp() + '/build/compiled/Assets/unpacked/' + tex['file']
|
||||
converted_path = arm.utils.get_fp() + '/build/compiled/Assets/unpacked/' + tex['file']
|
||||
filepath = converted_path
|
||||
# TODO: delete cache when file changes
|
||||
if not os.path.isfile(converted_path):
|
||||
armutils.write_image(image, converted_path, file_format=target_format)
|
||||
arm.utils.write_image(image, converted_path, file_format=target_format)
|
||||
assets.add(converted_path)
|
||||
else:
|
||||
# Link image path to assets
|
||||
assets.add(armutils.safe_assetpath(image.filepath))
|
||||
assets.add(arm.utils.safe_assetpath(image.filepath))
|
||||
|
||||
# Generate prefiltered envmaps
|
||||
world.world_envtex_name = tex['file']
|
||||
|
@ -256,7 +256,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
if image.packed_file != None:
|
||||
# Extract packed data
|
||||
filepath = '/build/compiled/Assets/unpacked'
|
||||
unpack_path = armutils.get_fp() + filepath
|
||||
unpack_path = arm.utils.get_fp() + filepath
|
||||
if not os.path.exists(unpack_path):
|
||||
os.makedirs(unpack_path)
|
||||
unpack_filepath = unpack_path + '/' + image.name
|
||||
|
@ -266,11 +266,11 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
assets.add(unpack_filepath)
|
||||
else:
|
||||
# Link image path to assets
|
||||
assets.add(armutils.safe_assetpath(image.filepath))
|
||||
assets.add(arm.utils.safe_assetpath(image.filepath))
|
||||
|
||||
# Reference image name
|
||||
tex['file'] = armutils.extract_filename(image.filepath)
|
||||
tex['file'] = armutils.safe_filename(tex['file'])
|
||||
tex['file'] = arm.utils.extract_filename(image.filepath)
|
||||
tex['file'] = arm.utils.safe_filename(tex['file'])
|
||||
|
||||
|
||||
# Append sky define
|
||||
|
@ -304,7 +304,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
else:
|
||||
hosek_path = 'armory/Assets/hosek_fake/'
|
||||
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
# Use fake maps for now
|
||||
assets.add(sdk_path + hosek_path + 'hosek_radiance.hdr')
|
||||
for i in range(0, 8):
|
0
blender/arm/material/__init__.py
Executable file
0
blender/arm/material/__init__.py
Executable file
|
@ -14,13 +14,13 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
import armutils
|
||||
import assets
|
||||
import make_state
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.texture as texture
|
||||
import armmaterial.functions as functions
|
||||
import log
|
||||
import arm.utils
|
||||
import arm.assets as assets
|
||||
import arm.make_state as make_state
|
||||
import arm.log as log
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.texture as texture
|
||||
import arm.material.functions as functions
|
||||
|
||||
def parse(nodes, vert, frag, geom, tesc, tese, parse_surface=True, parse_opacity=True, parse_displacement=True):
|
||||
output_node = node_by_type(nodes, 'OUTPUT_MATERIAL')
|
||||
|
@ -71,7 +71,7 @@ def parse_output(node, _vert, _frag, _geom, _tesc, _tese, _parse_surface, _parse
|
|||
# parse_volume_input(node.inputs[1])
|
||||
|
||||
# Displacement
|
||||
if parse_displacement and armutils.tess_enabled(make_state.target) and node.inputs[2].is_linked and tese != None:
|
||||
if parse_displacement and arm.utils.tess_enabled(make_state.target) and node.inputs[2].is_linked and tese != None:
|
||||
parsed = []
|
||||
parents = []
|
||||
normal_written = False
|
||||
|
@ -363,7 +363,7 @@ def glsltype(t):
|
|||
return 'float'
|
||||
|
||||
def touniform(inp):
|
||||
uname = armutils.safe_source_name(inp.node.name) + armutils.safe_source_name(inp.name)
|
||||
uname = arm.utils.safe_source_name(inp.node.name) + arm.utils.safe_source_name(inp.name)
|
||||
curshader.add_uniform(glsltype(inp.type) + ' ' + uname)
|
||||
return uname
|
||||
|
||||
|
@ -451,7 +451,7 @@ def parse_rgb(node, socket):
|
|||
# Already fetched
|
||||
if res_var_name(node, node.outputs[1]) in parsed:
|
||||
return '{0}.rgb'.format(store_var_name(node))
|
||||
tex_name = armutils.safe_source_name(node.name)
|
||||
tex_name = arm.utils.safe_source_name(node.name)
|
||||
tex = texture.make_texture(node, tex_name)
|
||||
if tex != None:
|
||||
to_linear = parsing_basecol and not tex['file'].endswith('.hdr')
|
||||
|
@ -504,7 +504,7 @@ def parse_rgb(node, socket):
|
|||
|
||||
elif node.type == 'TEX_VORONOI':
|
||||
curshader.add_function(functions.str_tex_voronoi)
|
||||
assets.add(armutils.get_sdk_path() + '/armory/Assets/' + 'noise64.png')
|
||||
assets.add(arm.utils.get_sdk_path() + '/armory/Assets/' + 'noise64.png')
|
||||
assets.add_embedded_data('noise64.png')
|
||||
curshader.add_uniform('sampler2D snoise', link='_noise64')
|
||||
if node.inputs[0].is_linked:
|
||||
|
@ -990,7 +990,7 @@ def parse_value(node, socket):
|
|||
# Already fetched
|
||||
if res_var_name(node, node.outputs[0]) in parsed:
|
||||
return '{0}.a'.format(store_var_name(node))
|
||||
tex_name = armutils.safe_source_name(node.name)
|
||||
tex_name = arm.utils.safe_source_name(node.name)
|
||||
tex = texture.make_texture(node, tex_name)
|
||||
if tex != None:
|
||||
return '{0}.a'.format(texture_store(node, tex, tex_name))
|
||||
|
@ -1030,7 +1030,7 @@ def parse_value(node, socket):
|
|||
|
||||
elif node.type == 'TEX_VORONOI':
|
||||
curshader.add_function(functions.str_tex_voronoi)
|
||||
assets.add(armutils.get_sdk_path() + '/armory/Assets/' + 'noise64.png')
|
||||
assets.add(arm.utils.get_sdk_path() + '/armory/Assets/' + 'noise64.png')
|
||||
assets.add_embedded_data('noise64.png')
|
||||
curshader.add_uniform('sampler2D snoise', link='_noise64')
|
||||
if node.inputs[0].is_linked:
|
||||
|
@ -1164,10 +1164,10 @@ def socket_index(node, socket):
|
|||
return i
|
||||
|
||||
def node_name(s):
|
||||
s = armutils.safe_source_name(s)
|
||||
s = arm.utils.safe_source_name(s)
|
||||
if len(parents) > 0:
|
||||
s = armutils.safe_source_name(parents[-1].name) + '_' + s
|
||||
s = arm.utils.safe_source_name(parents[-1].name) + '_' + s
|
||||
return s
|
||||
|
||||
def socket_name(s):
|
||||
return armutils.safe_source_name(s)
|
||||
return arm.utils.safe_source_name(s)
|
|
@ -1,9 +1,9 @@
|
|||
import bpy
|
||||
import armutils
|
||||
import armmaterial.make_shader as make_shader
|
||||
import armmaterial.mat_batch as mat_batch
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.texture as texture
|
||||
import arm.utils
|
||||
import arm.material.make_shader as make_shader
|
||||
import arm.material.mat_batch as mat_batch
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.texture as texture
|
||||
|
||||
def glsltype(t): # Merge with cycles
|
||||
if t == 'RGB' or t == 'RGBA' or t == 'VECTOR':
|
||||
|
@ -51,7 +51,7 @@ def parse(material, mat_data, mat_users, mat_armusers, rid):
|
|||
c['bind_textures'] = []
|
||||
for node in material.node_tree.nodes:
|
||||
if node.type == 'TEX_IMAGE':
|
||||
tex_name = armutils.safe_source_name(node.name)
|
||||
tex_name = arm.utils.safe_source_name(node.name)
|
||||
tex = texture.make_texture(node, tex_name)
|
||||
if tex == None: # Empty texture
|
||||
tex = {}
|
||||
|
@ -63,7 +63,7 @@ def parse(material, mat_data, mat_users, mat_armusers, rid):
|
|||
for node in material.node_tree.nodes:
|
||||
for inp in node.inputs:
|
||||
if inp.is_uniform:
|
||||
uname = armutils.safe_source_name(inp.node.name) + armutils.safe_source_name(inp.name) # Merge with cycles
|
||||
uname = arm.utils.safe_source_name(inp.node.name) + arm.utils.safe_source_name(inp.name) # Merge with cycles
|
||||
const = {}
|
||||
const['name'] = uname
|
||||
const[glsltype(inp.type)] = glslvalue(inp.default_value)
|
|
@ -1,9 +1,8 @@
|
|||
import bpy
|
||||
import make_state as state
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.mat_utils as mat_utils
|
||||
import armutils
|
||||
import assets
|
||||
import arm.make_state as state
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.mat_utils as mat_utils
|
||||
import arm.utils
|
||||
|
||||
def make(context_id):
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
import bpy
|
||||
import make_state as state
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.mat_utils as mat_utils
|
||||
import armmaterial.cycles as cycles
|
||||
import armmaterial.make_skin as make_skin
|
||||
import armmaterial.make_tess as make_tess
|
||||
import armutils
|
||||
import assets
|
||||
import arm.make_state as state
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.mat_utils as mat_utils
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.make_skin as make_skin
|
||||
import arm.material.make_tess as make_tess
|
||||
import arm.utils
|
||||
|
||||
is_displacement = False
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import armmaterial.cycles as cycles
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.make_mesh as make_mesh
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.make_mesh as make_mesh
|
||||
|
||||
def make(context_id):
|
||||
con_overlay = mat_state.data.add_context({ 'name': context_id, 'depth_write': True, 'compare_mode': 'less', 'cull_mode': 'clockwise' })
|
|
@ -1,18 +1,18 @@
|
|||
import armutils
|
||||
import os
|
||||
import bpy
|
||||
import assets
|
||||
import armmaterial.mat_utils as mat_utils
|
||||
import armmaterial.mat_state as mat_state
|
||||
from armmaterial.shader_data import ShaderData
|
||||
import armmaterial.cycles as cycles
|
||||
import armmaterial.make_mesh as make_mesh
|
||||
import armmaterial.make_shadowmap as make_shadowmap
|
||||
import armmaterial.make_transluc as make_transluc
|
||||
import armmaterial.make_overlay as make_overlay
|
||||
import armmaterial.make_depth as make_depth
|
||||
import armmaterial.make_decal as make_decal
|
||||
import armmaterial.make_voxel as make_voxel
|
||||
import arm.utils
|
||||
import arm.assets as assets
|
||||
import arm.material.mat_utils as mat_utils
|
||||
import arm.material.mat_state as mat_state
|
||||
from arm.material.shader_data import ShaderData
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.make_mesh as make_mesh
|
||||
import arm.material.make_shadowmap as make_shadowmap
|
||||
import arm.material.make_transluc as make_transluc
|
||||
import arm.material.make_overlay as make_overlay
|
||||
import arm.material.make_depth as make_depth
|
||||
import arm.material.make_decal as make_decal
|
||||
import arm.material.make_voxel as make_voxel
|
||||
|
||||
rpass_hook = None
|
||||
mesh_make = make_mesh.make
|
||||
|
@ -31,16 +31,16 @@ def build(material, mat_users, mat_armusers, rid):
|
|||
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
rpasses = mat_utils.get_rpasses(material)
|
||||
matname = armutils.safe_source_name(material.name)
|
||||
matname = arm.utils.safe_source_name(material.name)
|
||||
rel_path = 'build/compiled/ShaderRaws/' + matname
|
||||
full_path = armutils.get_fp() + '/' + rel_path
|
||||
full_path = arm.utils.get_fp() + '/' + rel_path
|
||||
if not os.path.exists(full_path):
|
||||
os.makedirs(full_path)
|
||||
|
||||
if mat_users != None:
|
||||
for bo in mat_users[material]:
|
||||
# GPU Skinning
|
||||
if bo.find_armature() and armutils.is_bone_animation_enabled(bo) and wrd.generate_gpu_skin == True:
|
||||
if bo.find_armature() and arm.utils.is_bone_animation_enabled(bo) and wrd.generate_gpu_skin == True:
|
||||
mat_state.data.add_elem('bone', 4)
|
||||
mat_state.data.add_elem('weight', 4)
|
||||
# Instancing
|
||||
|
@ -85,7 +85,7 @@ def build(material, mat_users, mat_armusers, rid):
|
|||
|
||||
write_shaders(rel_path, con, rp)
|
||||
|
||||
armutils.write_arm(full_path + '/' + matname + '_data.arm', mat_state.data.get())
|
||||
arm.utils.write_arm(full_path + '/' + matname + '_data.arm', mat_state.data.get())
|
||||
shader_data_name = matname + '_data'
|
||||
shader_data_path = 'build/compiled/ShaderRaws/' + matname + '/' + shader_data_name + '.arm'
|
||||
assets.add_shader_data(shader_data_path)
|
||||
|
@ -103,8 +103,8 @@ def write_shaders(rel_path, con, rpass):
|
|||
def write_shader(rel_path, shader, ext, rpass, keep_cache=True):
|
||||
if shader == None:
|
||||
return
|
||||
shader_rel_path = rel_path + '/' + armutils.safe_source_name(mat_state.material.name) + '_' + rpass + '.' + ext + '.glsl'
|
||||
shader_path = armutils.get_fp() + '/' + shader_rel_path
|
||||
shader_rel_path = rel_path + '/' + arm.utils.safe_source_name(mat_state.material.name) + '_' + rpass + '.' + ext + '.glsl'
|
||||
shader_path = arm.utils.get_fp() + '/' + shader_rel_path
|
||||
assets.add_shader(shader_rel_path)
|
||||
if not os.path.isfile(shader_path) or not keep_cache:
|
||||
with open(shader_path, 'w') as f:
|
|
@ -1,8 +1,8 @@
|
|||
import armmaterial.cycles as cycles
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.mat_utils as mat_utils
|
||||
import armmaterial.make_skin as make_skin
|
||||
import armmaterial.make_tess as make_tess
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.mat_utils as mat_utils
|
||||
import arm.material.make_skin as make_skin
|
||||
import arm.material.make_tess as make_tess
|
||||
|
||||
def make(context_id, rpasses):
|
||||
con_shadowmap = mat_state.data.add_context({ 'name': context_id, 'depth_write': True, 'compare_mode': 'less', 'cull_mode': 'clockwise', 'color_write_red': False, 'color_write_green': False, 'color_write_blue': False, 'color_write_alpha': False })
|
|
@ -1,6 +1,6 @@
|
|||
import armmaterial.cycles as cycles
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.make_mesh as make_mesh
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.make_mesh as make_mesh
|
||||
|
||||
def make(context_id):
|
||||
con_transluc = mat_state.data.add_context({ 'name': context_id, 'depth_write': False, 'compare_mode': 'less', 'cull_mode': 'clockwise', \
|
|
@ -1,7 +1,7 @@
|
|||
import armmaterial.cycles as cycles
|
||||
import armmaterial.mat_state as mat_state
|
||||
import armmaterial.mat_utils as mat_utils
|
||||
import bpy
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.material.mat_utils as mat_utils
|
||||
|
||||
def make(context_id):
|
||||
con_voxel = mat_state.data.add_context({ 'name': context_id, 'depth_write': False, 'compare_mode': 'always', 'cull_mode': 'none', 'color_write_red': False, 'color_write_green': False, 'color_write_blue': False, 'color_write_alpha': False })
|
|
@ -1,7 +1,7 @@
|
|||
import bpy
|
||||
import armmaterial.cycles as cycles
|
||||
import armmaterial.make_shader as make_shader
|
||||
import armmaterial.mat_state as mat_state
|
||||
import arm.material.cycles as cycles
|
||||
import arm.material.make_shader as make_shader
|
||||
import arm.material.mat_state as mat_state
|
||||
|
||||
# TODO: handle groups
|
||||
# TODO: handle cached shaders
|
|
@ -1,15 +1,15 @@
|
|||
import armutils
|
||||
import make_state
|
||||
import armmaterial.cycles as cycles
|
||||
import log
|
||||
import bpy
|
||||
import arm.utils
|
||||
import arm.make_state as make_state
|
||||
import arm.material.cycles as cycles
|
||||
import arm.log as log
|
||||
|
||||
add_mesh_contexts = []
|
||||
|
||||
def disp_linked(output_node):
|
||||
# Armory PBR with unlinked height socket
|
||||
linked = output_node.inputs[2].is_linked
|
||||
tess_enabled = armutils.tess_enabled(make_state.target)
|
||||
tess_enabled = arm.utils.tess_enabled(make_state.target)
|
||||
if linked:
|
||||
l = output_node.inputs[2].links[0]
|
||||
if l.from_node.type == 'GROUP' and l.from_node.node_tree.name.startswith('Armory PBR') and l.from_node.inputs[10].is_linked == False:
|
|
@ -1,5 +1,5 @@
|
|||
import bpy
|
||||
import make_utils
|
||||
import arm.make_utils as make_utils
|
||||
|
||||
class Shader:
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from armmaterial.shader import Shader
|
||||
import armutils
|
||||
from arm.material.shader import Shader
|
||||
import arm.utils
|
||||
|
||||
class ShaderData:
|
||||
|
||||
|
@ -9,7 +9,7 @@ class ShaderData:
|
|||
self.sd = {}
|
||||
self.data = {}
|
||||
self.data['shader_datas'] = [self.sd]
|
||||
self.matname = armutils.safe_source_name(material.name)
|
||||
self.matname = arm.utils.safe_source_name(material.name)
|
||||
self.sd['name'] = self.matname + '_data'
|
||||
self.sd['vertex_structure'] = []
|
||||
self.sd['contexts'] = []
|
||||
|
@ -58,7 +58,7 @@ class ShaderContext:
|
|||
self.tesc = None
|
||||
self.tese = None
|
||||
self.material = material
|
||||
self.matname = armutils.safe_source_name(material.name)
|
||||
self.matname = arm.utils.safe_source_name(material.name)
|
||||
self.shader_data = shader_data
|
||||
self.data = {}
|
||||
self.data['name'] = props['name']
|
|
@ -1,10 +1,10 @@
|
|||
import log
|
||||
import os
|
||||
import armutils
|
||||
import assets
|
||||
import armmaterial.mat_state as mat_state
|
||||
import make_state as state
|
||||
import bpy
|
||||
import os
|
||||
import arm.log as log
|
||||
import arm.utils
|
||||
import arm.assets as assets
|
||||
import arm.material.mat_state as mat_state
|
||||
import arm.make_state as state
|
||||
|
||||
def make_texture(image_node, tex_name, matname=None):
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
@ -23,8 +23,8 @@ def make_texture(image_node, tex_name, matname=None):
|
|||
return None
|
||||
|
||||
# Reference image name
|
||||
tex['file'] = armutils.extract_filename(image.filepath)
|
||||
tex['file'] = armutils.safefilename(tex['file'])
|
||||
tex['file'] = arm.utils.extract_filename(image.filepath)
|
||||
tex['file'] = arm.utils.safefilename(tex['file'])
|
||||
s = tex['file'].rsplit('.', 1)
|
||||
|
||||
if len(s) == 1:
|
||||
|
@ -39,14 +39,14 @@ def make_texture(image_node, tex_name, matname=None):
|
|||
|
||||
if image.packed_file != None:
|
||||
# Extract packed data
|
||||
unpack_path = armutils.get_fp() + '/build/compiled/Assets/unpacked'
|
||||
unpack_path = arm.utils.get_fp() + '/build/compiled/Assets/unpacked'
|
||||
if not os.path.exists(unpack_path):
|
||||
os.makedirs(unpack_path)
|
||||
unpack_filepath = unpack_path + '/' + tex['file']
|
||||
|
||||
if do_convert:
|
||||
if not os.path.isfile(unpack_filepath):
|
||||
armutils.write_image(image, unpack_filepath)
|
||||
arm.utils.write_image(image, unpack_filepath)
|
||||
|
||||
# Write bytes if size is different or file does not exist yet
|
||||
elif os.path.isfile(unpack_filepath) == False or os.path.getsize(unpack_filepath) != image.packed_file.size:
|
||||
|
@ -56,24 +56,24 @@ def make_texture(image_node, tex_name, matname=None):
|
|||
assets.add(unpack_filepath)
|
||||
|
||||
else:
|
||||
if not os.path.isfile(armutils.safe_assetpath(image.filepath)):
|
||||
if not os.path.isfile(arm.utils.safe_assetpath(image.filepath)):
|
||||
log.warn('Material ' + matname + '/' + image.name + ' - file not found(' + image.filepath + ')')
|
||||
return None
|
||||
|
||||
if do_convert:
|
||||
converted_path = armutils.get_fp() + '/build/compiled/Assets/unpacked/' + tex['file']
|
||||
converted_path = arm.utils.get_fp() + '/build/compiled/Assets/unpacked/' + tex['file']
|
||||
# TODO: delete cache when file changes
|
||||
if not os.path.isfile(converted_path):
|
||||
armutils.write_image(image, converted_path)
|
||||
arm.utils.write_image(image, converted_path)
|
||||
assets.add(converted_path)
|
||||
else:
|
||||
# Link image path to assets
|
||||
# TODO: Khamake converts .PNG to .jpg? Convert ext to lowercase on windows
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
s = image.filepath.rsplit('.', 1)
|
||||
assets.add(armutils.safe_assetpath(s[0] + '.' + s[1].lower()))
|
||||
assets.add(arm.utils.safe_assetpath(s[0] + '.' + s[1].lower()))
|
||||
else:
|
||||
assets.add(armutils.safe_assetpath(image.filepath))
|
||||
assets.add(arm.utils.safe_assetpath(image.filepath))
|
||||
|
||||
|
||||
# if image_format != 'RGBA32':
|
|
@ -3,7 +3,7 @@ from bpy.types import NodeTree
|
|||
from bpy.props import *
|
||||
import nodeitems_utils
|
||||
from nodeitems_utils import NodeCategory
|
||||
from logicnode import *
|
||||
from arm.logicnode import *
|
||||
|
||||
registered_nodes = []
|
||||
|
||||
|
@ -46,9 +46,9 @@ def unregister_nodes():
|
|||
nodeitems_utils.unregister_node_categories("ArmLogicNodes")
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ArmLogicTree)
|
||||
register_nodes()
|
||||
|
||||
def unregister():
|
||||
unregister_nodes()
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ArmLogicTree)
|
|
@ -1,8 +1,6 @@
|
|||
import bpy
|
||||
from bpy.types import NodeTree, Node, NodeSocket
|
||||
from bpy.props import *
|
||||
import armutils
|
||||
import make_renderer
|
||||
|
||||
class CGPipelineTree(NodeTree):
|
||||
'''Render path nodes'''
|
||||
|
@ -745,7 +743,7 @@ class BackgroundColorNode(Node, CGPipelineTreeNode):
|
|||
def init(self, context):
|
||||
self.outputs.new('NodeSocketInt', "Color")
|
||||
|
||||
class LampCount(Node, CGPipelineTreeNode):
|
||||
class LampCountNode(Node, CGPipelineTreeNode):
|
||||
'''Reference number of visible lamps in scene node'''
|
||||
bl_idname = 'LampCountNodeType'
|
||||
bl_label = 'Lamp Count'
|
||||
|
@ -850,43 +848,118 @@ node_categories = [
|
|||
]),
|
||||
]
|
||||
|
||||
# Handling node data
|
||||
def reload_blend_data():
|
||||
if bpy.data.node_groups.get('Armory PBR') == None:
|
||||
load_library('Armory PBR')
|
||||
check_default()
|
||||
|
||||
def check_default():
|
||||
if bpy.data.node_groups.get('armory_default') == None and len(bpy.data.cameras) > 0:
|
||||
make_renderer.make_renderer(bpy.data.cameras[0])
|
||||
|
||||
def load_library(asset_name, rename=None):
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
data_path = sdk_path + '/armory/blender/data/data.blend'
|
||||
data_names = [asset_name]
|
||||
|
||||
# Remove old
|
||||
if rename != None and rename in bpy.data.node_groups and asset_name != 'Armory PBR':
|
||||
bpy.data.node_groups.remove(bpy.data.node_groups[rename], do_unlink=True)
|
||||
|
||||
# Import
|
||||
data_refs = data_names.copy()
|
||||
with bpy.data.libraries.load(data_path, link=False) as (data_from, data_to):
|
||||
data_to.node_groups = data_refs
|
||||
|
||||
for ref in data_refs:
|
||||
ref.use_fake_user = True
|
||||
if rename != None:
|
||||
ref.name = rename
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
try:
|
||||
nodeitems_utils.register_node_categories("CG_PIPELINE_NODES", node_categories)
|
||||
reload_blend_data()
|
||||
except:
|
||||
pass
|
||||
bpy.utils.register_class(BeginNode)
|
||||
bpy.utils.register_class(DrawMeshesNode)
|
||||
bpy.utils.register_class(DrawDecalsNode)
|
||||
bpy.utils.register_class(ClearTargetNode)
|
||||
bpy.utils.register_class(ClearImageNode)
|
||||
bpy.utils.register_class(GenerateMipmapsNode)
|
||||
bpy.utils.register_class(SetTargetNode)
|
||||
bpy.utils.register_class(SetViewportNode)
|
||||
bpy.utils.register_class(BindTargetNode)
|
||||
bpy.utils.register_class(DrawMaterialQuadNode)
|
||||
bpy.utils.register_class(DrawQuadNode)
|
||||
bpy.utils.register_class(DrawWorldNode)
|
||||
bpy.utils.register_class(DrawCompositorNode)
|
||||
bpy.utils.register_class(DrawCompositorWithFXAANode)
|
||||
bpy.utils.register_class(DrawGreasePencilNode)
|
||||
bpy.utils.register_class(TargetNode)
|
||||
bpy.utils.register_class(ShadowMapNode)
|
||||
bpy.utils.register_class(ImageNode)
|
||||
bpy.utils.register_class(Image3DNode)
|
||||
bpy.utils.register_class(TargetArrayNode)
|
||||
bpy.utils.register_class(DepthBufferNode)
|
||||
bpy.utils.register_class(GBufferNode)
|
||||
bpy.utils.register_class(FramebufferNode)
|
||||
bpy.utils.register_class(QuadPassNode)
|
||||
bpy.utils.register_class(SSAOPassNode)
|
||||
bpy.utils.register_class(SSAOReprojectPassNode)
|
||||
bpy.utils.register_class(ApplySSAOPassNode)
|
||||
bpy.utils.register_class(SSRPassNode)
|
||||
bpy.utils.register_class(BloomPassNode)
|
||||
bpy.utils.register_class(MotionBlurPassNode)
|
||||
bpy.utils.register_class(MotionBlurVelocityPassNode)
|
||||
bpy.utils.register_class(CopyPassNode)
|
||||
bpy.utils.register_class(BlendPassNode)
|
||||
bpy.utils.register_class(CombinePassNode)
|
||||
bpy.utils.register_class(BlurBasicPassNode)
|
||||
bpy.utils.register_class(DebugNormalsPassNode)
|
||||
bpy.utils.register_class(FXAAPassNode)
|
||||
bpy.utils.register_class(SMAAPassNode)
|
||||
bpy.utils.register_class(TAAPassNode)
|
||||
bpy.utils.register_class(SSSPassNode)
|
||||
bpy.utils.register_class(WaterPassNode)
|
||||
bpy.utils.register_class(DeferredLightPassNode)
|
||||
bpy.utils.register_class(DeferredIndirectPassNode)
|
||||
bpy.utils.register_class(VolumetricLightPassNode)
|
||||
bpy.utils.register_class(TranslucentResolvePassNode)
|
||||
bpy.utils.register_class(ScreenNode)
|
||||
bpy.utils.register_class(BackgroundColorNode)
|
||||
bpy.utils.register_class(LampCountNode)
|
||||
bpy.utils.register_class(CallFunctionNode)
|
||||
bpy.utils.register_class(BranchFunctionNode)
|
||||
bpy.utils.register_class(MergeStagesNode)
|
||||
bpy.utils.register_class(LoopStagesNode)
|
||||
bpy.utils.register_class(LoopLampsNode)
|
||||
bpy.utils.register_class(DrawStereoNode)
|
||||
|
||||
nodeitems_utils.register_node_categories("CG_PIPELINE_NODES", node_categories)
|
||||
|
||||
def unregister():
|
||||
nodeitems_utils.unregister_node_categories("CG_PIPELINE_NODES")
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
bpy.utils.unregister_class(BeginNode)
|
||||
bpy.utils.unregister_class(DrawMeshesNode)
|
||||
bpy.utils.unregister_class(DrawDecalsNode)
|
||||
bpy.utils.unregister_class(ClearTargetNode)
|
||||
bpy.utils.unregister_class(ClearImageNode)
|
||||
bpy.utils.unregister_class(GenerateMipmapsNode)
|
||||
bpy.utils.unregister_class(SetTargetNode)
|
||||
bpy.utils.unregister_class(SetViewportNode)
|
||||
bpy.utils.unregister_class(BindTargetNode)
|
||||
bpy.utils.unregister_class(DrawMaterialQuadNode)
|
||||
bpy.utils.unregister_class(DrawQuadNode)
|
||||
bpy.utils.unregister_class(DrawWorldNode)
|
||||
bpy.utils.unregister_class(DrawCompositorNode)
|
||||
bpy.utils.unregister_class(DrawCompositorWithFXAANode)
|
||||
bpy.utils.unregister_class(DrawGreasePencilNode)
|
||||
bpy.utils.unregister_class(TargetNode)
|
||||
bpy.utils.unregister_class(ShadowMapNode)
|
||||
bpy.utils.unregister_class(ImageNode)
|
||||
bpy.utils.unregister_class(Image3DNode)
|
||||
bpy.utils.unregister_class(TargetArrayNode)
|
||||
bpy.utils.unregister_class(DepthBufferNode)
|
||||
bpy.utils.unregister_class(GBufferNode)
|
||||
bpy.utils.unregister_class(FramebufferNode)
|
||||
bpy.utils.unregister_class(QuadPassNode)
|
||||
bpy.utils.unregister_class(SSAOPassNode)
|
||||
bpy.utils.unregister_class(SSAOReprojectPassNode)
|
||||
bpy.utils.unregister_class(ApplySSAOPassNode)
|
||||
bpy.utils.unregister_class(SSRPassNode)
|
||||
bpy.utils.unregister_class(BloomPassNode)
|
||||
bpy.utils.unregister_class(MotionBlurPassNode)
|
||||
bpy.utils.unregister_class(MotionBlurVelocityPassNode)
|
||||
bpy.utils.unregister_class(CopyPassNode)
|
||||
bpy.utils.unregister_class(BlendPassNode)
|
||||
bpy.utils.unregister_class(CombinePassNode)
|
||||
bpy.utils.unregister_class(BlurBasicPassNode)
|
||||
bpy.utils.unregister_class(DebugNormalsPassNode)
|
||||
bpy.utils.unregister_class(FXAAPassNode)
|
||||
bpy.utils.unregister_class(SMAAPassNode)
|
||||
bpy.utils.unregister_class(TAAPassNode)
|
||||
bpy.utils.unregister_class(SSSPassNode)
|
||||
bpy.utils.unregister_class(WaterPassNode)
|
||||
bpy.utils.unregister_class(DeferredLightPassNode)
|
||||
bpy.utils.unregister_class(DeferredIndirectPassNode)
|
||||
bpy.utils.unregister_class(VolumetricLightPassNode)
|
||||
bpy.utils.unregister_class(TranslucentResolvePassNode)
|
||||
bpy.utils.unregister_class(ScreenNode)
|
||||
bpy.utils.unregister_class(BackgroundColorNode)
|
||||
bpy.utils.unregister_class(LampCountNode)
|
||||
bpy.utils.unregister_class(CallFunctionNode)
|
||||
bpy.utils.unregister_class(BranchFunctionNode)
|
||||
bpy.utils.unregister_class(MergeStagesNode)
|
||||
bpy.utils.unregister_class(LoopStagesNode)
|
||||
bpy.utils.unregister_class(LoopLampsNode)
|
||||
bpy.utils.unregister_class(DrawStereoNode)
|
|
@ -1,15 +1,15 @@
|
|||
import bpy
|
||||
from bpy.props import *
|
||||
from props_traits_clip import *
|
||||
from props_traits_action import *
|
||||
from props_traits_library import *
|
||||
import props_ui
|
||||
import props_renderer
|
||||
import assets
|
||||
import log
|
||||
import armutils
|
||||
import os
|
||||
import shutil
|
||||
from arm.props_traits_clip import *
|
||||
from arm.props_traits_action import *
|
||||
from arm.props_traits_library import *
|
||||
import arm.props_ui as props_ui
|
||||
import arm.props_renderer as props_renderer
|
||||
import arm.assets as assets
|
||||
import arm.log as log
|
||||
import arm.utils
|
||||
try:
|
||||
import barmory
|
||||
except ImportError:
|
||||
|
@ -60,28 +60,28 @@ def update_mat_cache(self, context):
|
|||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
||||
|
||||
def update_gapi_win(self, context):
|
||||
if os.path.isdir(armutils.get_fp() + 'build/windows-build'):
|
||||
shutil.rmtree(armutils.get_fp() + 'build/windows-build')
|
||||
if os.path.isdir(arm.utils.get_fp() + 'build/windows-build'):
|
||||
shutil.rmtree(arm.utils.get_fp() + 'build/windows-build')
|
||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
||||
|
||||
def update_gapi_linux(self, context):
|
||||
if os.path.isdir(armutils.get_fp() + 'build/linux-build'):
|
||||
shutil.rmtree(armutils.get_fp() + 'build/linux-build')
|
||||
if os.path.isdir(arm.utils.get_fp() + 'build/linux-build'):
|
||||
shutil.rmtree(arm.utils.get_fp() + 'build/linux-build')
|
||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
||||
|
||||
def update_gapi_mac(self, context):
|
||||
if os.path.isdir(armutils.get_fp() + 'build/osx-build'):
|
||||
shutil.rmtree(armutils.get_fp() + 'build/osx-build')
|
||||
if os.path.isdir(arm.utils.get_fp() + 'build/osx-build'):
|
||||
shutil.rmtree(arm.utils.get_fp() + 'build/osx-build')
|
||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
||||
|
||||
def update_gapi_android(self, context):
|
||||
if os.path.isdir(armutils.get_fp() + 'build/android-build'):
|
||||
shutil.rmtree(armutils.get_fp() + 'build/android-build')
|
||||
if os.path.isdir(arm.utils.get_fp() + 'build/android-build'):
|
||||
shutil.rmtree(arm.utils.get_fp() + 'build/android-build')
|
||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
||||
|
||||
def update_gapi_ios(self, context):
|
||||
if os.path.isdir(armutils.get_fp() + 'build/ios-build'):
|
||||
shutil.rmtree(armutils.get_fp() + 'build/ios-build')
|
||||
if os.path.isdir(arm.utils.get_fp() + 'build/ios-build'):
|
||||
shutil.rmtree(arm.utils.get_fp() + 'build/ios-build')
|
||||
bpy.data.worlds['Arm'].arm_recompile_trigger = True
|
||||
|
||||
def update_gapi_html5(self, context):
|
||||
|
@ -550,7 +550,7 @@ def init_properties_on_load():
|
|||
if not 'Arm' in bpy.data.worlds:
|
||||
init_properties()
|
||||
|
||||
armutils.fetch_script_names()
|
||||
arm.utils.fetch_script_names()
|
||||
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
|
@ -560,12 +560,12 @@ def init_properties_on_load():
|
|||
wrd.arm_version = arm_ver
|
||||
|
||||
# Set url for embedded player
|
||||
if armutils.with_krom():
|
||||
barmory.set_files_location(armutils.get_fp() + '/build/krom')
|
||||
if arm.utils.with_krom():
|
||||
barmory.set_files_location(arm.utils.get_fp() + '/build/krom')
|
||||
|
||||
def register():
|
||||
init_properties()
|
||||
armutils.fetch_bundled_script_names()
|
||||
arm.utils.fetch_bundled_script_names()
|
||||
|
||||
def unregister():
|
||||
pass
|
|
@ -186,8 +186,19 @@ class ToolsLodPanel(bpy.types.Panel):
|
|||
layout.prop(wrd, 'arm_lod_gen_ratio')
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ListLodItem)
|
||||
bpy.utils.register_class(MY_UL_LodList)
|
||||
bpy.utils.register_class(LIST_OT_LodNewItem)
|
||||
bpy.utils.register_class(LIST_OT_LodDeleteItem)
|
||||
bpy.utils.register_class(ArmoryGenerateLodButton)
|
||||
bpy.utils.register_class(ToolsLodPanel)
|
||||
|
||||
initObjectProperties()
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ListLodItem)
|
||||
bpy.utils.unregister_class(MY_UL_LodList)
|
||||
bpy.utils.unregister_class(LIST_OT_LodNewItem)
|
||||
bpy.utils.unregister_class(LIST_OT_LodDeleteItem)
|
||||
bpy.utils.unregister_class(ArmoryGenerateLodButton)
|
||||
bpy.utils.unregister_class(ToolsLodPanel)
|
|
@ -43,7 +43,9 @@ class SceneNavigationPropsPanel(bpy.types.Panel):
|
|||
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ArmoryGenerateNavmeshButton)
|
||||
bpy.utils.register_class(SceneNavigationPropsPanel)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ArmoryGenerateNavmeshButton)
|
||||
bpy.utils.unregister_class(SceneNavigationPropsPanel)
|
|
@ -1,9 +1,9 @@
|
|||
import bpy
|
||||
import nodes_renderpath
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
import make_renderer
|
||||
import assets
|
||||
import arm.nodes_renderpath as nodes_renderpath
|
||||
import arm.make_renderer as make_renderer
|
||||
import arm.assets as assets
|
||||
|
||||
updating_preset = False
|
||||
|
||||
|
@ -321,7 +321,9 @@ class PropsRPDataPropsPanel(bpy.types.Panel):
|
|||
layout.prop(wrd, 'generate_voxelgi_dimensions')
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(GenRPDataPropsPanel)
|
||||
bpy.utils.register_class(PropsRPDataPropsPanel)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(GenRPDataPropsPanel)
|
||||
bpy.utils.unregister_class(PropsRPDataPropsPanel)
|
|
@ -1,13 +1,13 @@
|
|||
import shutil
|
||||
import bpy
|
||||
import subprocess
|
||||
import os
|
||||
import json
|
||||
from props_traits_params import *
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
import armutils
|
||||
import write_data
|
||||
import subprocess
|
||||
from arm.props_traits_params import *
|
||||
import arm.utils
|
||||
import arm.write_data as write_data
|
||||
|
||||
class ListTraitItem(bpy.types.PropertyGroup):
|
||||
# Group of properties representing an item in the list
|
||||
|
@ -159,20 +159,20 @@ class ArmoryEditScriptButton(bpy.types.Operator):
|
|||
bl_label = 'Edit Script'
|
||||
|
||||
def execute(self, context):
|
||||
project_path = armutils.get_fp()
|
||||
project_path = arm.utils.get_fp()
|
||||
item = context.object.my_traitlist[context.object.traitlist_index]
|
||||
hx_path = project_path + '/Sources/' + bpy.data.worlds['Arm'].arm_project_package + '/' + item.class_name_prop + '.hx'
|
||||
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
if armutils.get_os() == 'win':
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
if arm.utils.get_os() == 'win':
|
||||
kode_path = sdk_path + '/win32/Kode Studio.exe'
|
||||
subprocess.Popen([kode_path, armutils.get_fp(), hx_path])
|
||||
elif armutils.get_os() == 'mac':
|
||||
subprocess.Popen([kode_path, arm.utils.get_fp(), hx_path])
|
||||
elif arm.utils.get_os() == 'mac':
|
||||
kode_path = '"' + sdk_path + '/Kode Studio.app/Contents/MacOS/Electron"'
|
||||
subprocess.Popen([kode_path + ' ' + armutils.get_fp() + ' ' + hx_path], shell=True)
|
||||
subprocess.Popen([kode_path + ' ' + arm.utils.get_fp() + ' ' + hx_path], shell=True)
|
||||
else:
|
||||
kode_path = sdk_path + '/linux64/kodestudio'
|
||||
subprocess.Popen([kode_path, armutils.get_fp(), hx_path])
|
||||
subprocess.Popen([kode_path, arm.utils.get_fp(), hx_path])
|
||||
|
||||
return{'FINISHED'}
|
||||
|
||||
|
@ -182,8 +182,8 @@ class ArmoryEditBundledScriptButton(bpy.types.Operator):
|
|||
bl_label = 'Edit Script'
|
||||
|
||||
def execute(self, context):
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
project_path = armutils.get_fp()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
project_path = arm.utils.get_fp()
|
||||
pkg = bpy.data.worlds['Arm'].arm_project_package
|
||||
item = context.object.my_traitlist[context.object.traitlist_index]
|
||||
source_hx_path = sdk_path + '/armory/Sources/armory/trait/' + item.class_name_prop + '.hx'
|
||||
|
@ -198,7 +198,7 @@ class ArmoryEditBundledScriptButton(bpy.types.Operator):
|
|||
shutil.copyfileobj(sf, tf)
|
||||
sf.close()
|
||||
tf.close()
|
||||
armutils.fetch_script_names()
|
||||
arm.utils.fetch_script_names()
|
||||
|
||||
# From bundled to script
|
||||
item.type_prop = 'Haxe Script'
|
||||
|
@ -218,14 +218,14 @@ class ArmoryNewScriptDialog(bpy.types.Operator):
|
|||
def execute(self, context):
|
||||
self.class_name = self.class_name.replace(' ', '')
|
||||
write_data.write_traithx(self.class_name)
|
||||
armutils.fetch_script_names()
|
||||
arm.utils.fetch_script_names()
|
||||
obj = context.object
|
||||
item = obj.my_traitlist[obj.traitlist_index]
|
||||
item.class_name_prop = self.class_name
|
||||
return {'FINISHED'}
|
||||
|
||||
def invoke(self, context, event):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {'CANCELLED'}
|
||||
self.class_name = 'MyTrait'
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
@ -236,8 +236,8 @@ class ArmoryRefreshScriptsListButton(bpy.types.Operator):
|
|||
bl_label = 'Refresh Scripts List'
|
||||
|
||||
def execute(self, context):
|
||||
armutils.fetch_bundled_script_names()
|
||||
armutils.fetch_script_names()
|
||||
arm.utils.fetch_bundled_script_names()
|
||||
arm.utils.fetch_script_names()
|
||||
return{'FINISHED'}
|
||||
|
||||
# Menu in tools region
|
||||
|
@ -331,9 +331,28 @@ class ToolsTraitsPanel(bpy.types.Panel):
|
|||
row = layout.row()
|
||||
row.prop_search(item, "nodes_name_prop", bpy.data, "node_groups", "Tree")
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
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)
|
||||
bpy.utils.register_class(ArmoryNewScriptDialog)
|
||||
bpy.utils.register_class(ArmoryRefreshScriptsListButton)
|
||||
bpy.utils.register_class(ToolsTraitsPanel)
|
||||
|
||||
initObjectProperties()
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
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)
|
||||
bpy.utils.unregister_class(ArmoryNewScriptDialog)
|
||||
bpy.utils.unregister_class(ArmoryRefreshScriptsListButton)
|
||||
bpy.utils.unregister_class(ToolsTraitsPanel)
|
|
@ -125,7 +125,15 @@ class LIST_OT_ActionTraitMoveItem(bpy.types.Operator):
|
|||
return{'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ListActionTraitItem)
|
||||
bpy.utils.register_class(MY_UL_ActionTraitList)
|
||||
bpy.utils.register_class(LIST_OT_ActionTraitNewItem)
|
||||
bpy.utils.register_class(LIST_OT_ActionTraitDeleteItem)
|
||||
bpy.utils.register_class(LIST_OT_ActionTraitMoveItem)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ListActionTraitItem)
|
||||
bpy.utils.unregister_class(MY_UL_ActionTraitList)
|
||||
bpy.utils.unregister_class(LIST_OT_ActionTraitNewItem)
|
||||
bpy.utils.unregister_class(LIST_OT_ActionTraitDeleteItem)
|
||||
bpy.utils.unregister_class(LIST_OT_ActionTraitMoveItem)
|
|
@ -146,7 +146,15 @@ class LIST_OT_ClipTraitMoveItem(bpy.types.Operator):
|
|||
return{'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ListClipTraitItem)
|
||||
bpy.utils.register_class(MY_UL_ClipTraitList)
|
||||
bpy.utils.register_class(LIST_OT_ClipTraitNewItem)
|
||||
bpy.utils.register_class(LIST_OT_ClipTraitDeleteItem)
|
||||
bpy.utils.register_class(LIST_OT_ClipTraitMoveItem)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ListClipTraitItem)
|
||||
bpy.utils.unregister_class(MY_UL_ClipTraitList)
|
||||
bpy.utils.unregister_class(LIST_OT_ClipTraitNewItem)
|
||||
bpy.utils.unregister_class(LIST_OT_ClipTraitDeleteItem)
|
||||
bpy.utils.unregister_class(LIST_OT_ClipTraitMoveItem)
|
|
@ -119,7 +119,15 @@ class LIST_OT_LibraryTraitMoveItem(bpy.types.Operator):
|
|||
return{'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ListLibraryTraitItem)
|
||||
bpy.utils.register_class(MY_UL_LibraryTraitList)
|
||||
bpy.utils.register_class(LIST_OT_LibraryTraitNewItem)
|
||||
bpy.utils.register_class(LIST_OT_LibraryTraitDeleteItem)
|
||||
bpy.utils.register_class(LIST_OT_LibraryTraitMoveItem)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ListLibraryTraitItem)
|
||||
bpy.utils.unregister_class(MY_UL_LibraryTraitList)
|
||||
bpy.utils.unregister_class(LIST_OT_LibraryTraitNewItem)
|
||||
bpy.utils.unregister_class(LIST_OT_LibraryTraitDeleteItem)
|
||||
bpy.utils.unregister_class(LIST_OT_LibraryTraitMoveItem)
|
|
@ -4,7 +4,7 @@ import os
|
|||
import json
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
from armutils import to_hex
|
||||
from arm.utils import to_hex
|
||||
|
||||
def object_picker_update(self, context):
|
||||
o = context.object
|
||||
|
@ -155,7 +155,15 @@ class LIST_OT_ParamsTraitMoveItem(bpy.types.Operator):
|
|||
return{'FINISHED'}
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ListParamsTraitItem)
|
||||
bpy.utils.register_class(MY_UL_ParamsTraitList)
|
||||
bpy.utils.register_class(LIST_OT_ParamsTraitNewItem)
|
||||
bpy.utils.register_class(LIST_OT_ParamsTraitDeleteItem)
|
||||
bpy.utils.register_class(LIST_OT_ParamsTraitMoveItem)
|
||||
|
||||
def unregister():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
bpy.utils.unregister_class(ListParamsTraitItem)
|
||||
bpy.utils.unregister_class(MY_UL_ParamsTraitList)
|
||||
bpy.utils.unregister_class(LIST_OT_ParamsTraitNewItem)
|
||||
bpy.utils.unregister_class(LIST_OT_ParamsTraitDeleteItem)
|
||||
bpy.utils.unregister_class(LIST_OT_ParamsTraitMoveItem)
|
|
@ -1,17 +1,17 @@
|
|||
import bpy
|
||||
import subprocess
|
||||
import nodes_renderpath
|
||||
import webbrowser
|
||||
from bpy.types import Menu, Panel, UIList
|
||||
from bpy.props import *
|
||||
from props_traits_clip import *
|
||||
from props_traits_action import *
|
||||
import armutils
|
||||
import make
|
||||
import make_utils
|
||||
import make_state as state
|
||||
import assets
|
||||
import log
|
||||
import webbrowser
|
||||
from arm.props_traits_clip import *
|
||||
from arm.props_traits_action import *
|
||||
import arm.utils
|
||||
import arm.make_renderer as make_renderer
|
||||
import arm.make as make
|
||||
import arm.make_utils as make_utils
|
||||
import arm.make_state as state
|
||||
import arm.assets as assets
|
||||
import arm.log as log
|
||||
|
||||
# Menu in object region
|
||||
class ObjectPropsPanel(bpy.types.Panel):
|
||||
|
@ -393,7 +393,7 @@ class ArmoryPlayerPanel(bpy.types.Panel):
|
|||
if wrd.arm_play_advanced:
|
||||
# layout.prop(wrd, make_utils.runtime_to_gapi())
|
||||
layout.prop(wrd, 'arm_play_console')
|
||||
if armutils.with_krom():
|
||||
if arm.utils.with_krom():
|
||||
row = layout.row(align=True)
|
||||
row.prop(wrd, 'arm_play_live_patch')
|
||||
if wrd.arm_play_live_patch:
|
||||
|
@ -424,7 +424,6 @@ class ArmoryProjectPanel(bpy.types.Panel):
|
|||
bl_region_type = "WINDOW"
|
||||
bl_context = "render"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
info_text = ''
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -488,16 +487,16 @@ class ArmoryPlayButton(bpy.types.Operator):
|
|||
if state.compileproc != None:
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_camera(self):
|
||||
if not arm.utils.check_camera(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_sdkpath(self):
|
||||
if not arm.utils.check_sdkpath(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
nodes_renderpath.check_default()
|
||||
make_renderer.check_default()
|
||||
|
||||
assets.invalidate_enabled = False
|
||||
make.play_project(False)
|
||||
|
@ -513,25 +512,24 @@ class ArmoryPlayInViewportButton(bpy.types.Operator):
|
|||
if state.compileproc != None:
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_camera(self):
|
||||
if not arm.utils.check_camera(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_sdkpath(self):
|
||||
if not arm.utils.check_sdkpath(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if context.area == None:
|
||||
return {"CANCELLED"}
|
||||
|
||||
nodes_renderpath.check_default()
|
||||
make_renderer.check_default()
|
||||
|
||||
assets.invalidate_enabled = False
|
||||
if state.playproc == None and state.krom_running == False:
|
||||
if context.area.type != 'VIEW_3D':
|
||||
return {"CANCELLED"}
|
||||
log.clear()
|
||||
# Cancel viewport render
|
||||
for space in context.area.spaces:
|
||||
if space.type == 'VIEW_3D':
|
||||
|
@ -559,13 +557,13 @@ class ArmoryBuildButton(bpy.types.Operator):
|
|||
bl_label = 'Build'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_camera(self):
|
||||
if not arm.utils.check_camera(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_sdkpath(self):
|
||||
if not arm.utils.check_sdkpath(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
state.target = make.runtime_to_target(in_viewport=False)
|
||||
|
@ -581,13 +579,13 @@ class ArmoryBuildProjectButton(bpy.types.Operator):
|
|||
bl_label = 'Build'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_camera(self):
|
||||
if not arm.utils.check_camera(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_sdkpath(self):
|
||||
if not arm.utils.check_sdkpath(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
state.target = bpy.data.worlds['Arm'].arm_project_target
|
||||
|
@ -614,10 +612,10 @@ class ArmoryOpenProjectFolderButton(bpy.types.Operator):
|
|||
bl_label = 'Project Folder'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
webbrowser.open('file://' + armutils.get_fp())
|
||||
webbrowser.open('file://' + arm.utils.get_fp())
|
||||
return{'FINISHED'}
|
||||
|
||||
class ArmoryCheckUpdatesButton(bpy.types.Operator):
|
||||
|
@ -654,7 +652,7 @@ class ArmoryKodeStudioButton(bpy.types.Operator):
|
|||
bl_description = 'Open Project in Kode Studio'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
make_utils.kode_studio()
|
||||
|
@ -684,7 +682,7 @@ class ArmoryCleanCacheButton(bpy.types.Operator):
|
|||
bl_label = 'Clean Cache'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
make.clean_cache()
|
||||
|
@ -696,7 +694,7 @@ class ArmoryCleanProjectButton(bpy.types.Operator):
|
|||
bl_label = 'Clean Project'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
make.clean_project()
|
||||
|
@ -708,13 +706,13 @@ class ArmoryPublishButton(bpy.types.Operator):
|
|||
bl_label = 'Publish'
|
||||
|
||||
def execute(self, context):
|
||||
if not armutils.check_saved(self):
|
||||
if not arm.utils.check_saved(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_camera(self):
|
||||
if not arm.utils.check_camera(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
if not armutils.check_sdkpath(self):
|
||||
if not arm.utils.check_sdkpath(self):
|
||||
return {"CANCELLED"}
|
||||
|
||||
make.publish_project()
|
||||
|
@ -737,7 +735,7 @@ class ArmoryRenderButton(bpy.types.Operator):
|
|||
def draw_view3d_header(self, context):
|
||||
layout = self.layout
|
||||
if state.playproc == None and state.compileproc == None:
|
||||
if armutils.with_krom():
|
||||
if arm.utils.with_krom():
|
||||
layout.operator("arm.play_in_viewport", icon="PLAY")
|
||||
else:
|
||||
layout.operator("arm.play", icon="PLAY")
|
||||
|
@ -750,15 +748,73 @@ def draw_info_header(self, context):
|
|||
wrd = bpy.data.worlds['Arm']
|
||||
if wrd.arm_progress < 100:
|
||||
layout.prop(wrd, 'arm_progress')
|
||||
if ArmoryProjectPanel.info_text != '':
|
||||
layout.label(ArmoryProjectPanel.info_text)
|
||||
if log.info_text != '':
|
||||
layout.label(log.info_text)
|
||||
|
||||
def register():
|
||||
bpy.utils.register_module(__name__)
|
||||
bpy.utils.register_class(ObjectPropsPanel)
|
||||
bpy.utils.register_class(ModifiersPropsPanel)
|
||||
bpy.utils.register_class(PhysicsPropsPanel)
|
||||
bpy.utils.register_class(DataPropsPanel)
|
||||
bpy.utils.register_class(ScenePropsPanel)
|
||||
bpy.utils.register_class(InvalidateCacheButton)
|
||||
bpy.utils.register_class(InvalidateMaterialCacheButton)
|
||||
bpy.utils.register_class(InvalidateGPCacheButton)
|
||||
bpy.utils.register_class(MaterialPropsPanel)
|
||||
bpy.utils.register_class(WorldPropsPanel)
|
||||
bpy.utils.register_class(ArmoryPlayerPanel)
|
||||
bpy.utils.register_class(ArmoryProjectPanel)
|
||||
bpy.utils.register_class(ArmoryPlayButton)
|
||||
bpy.utils.register_class(ArmoryPlayInViewportButton)
|
||||
bpy.utils.register_class(ArmoryStopButton)
|
||||
bpy.utils.register_class(ArmoryBuildButton)
|
||||
bpy.utils.register_class(ArmoryBuildProjectButton)
|
||||
bpy.utils.register_class(ArmoryPatchButton)
|
||||
bpy.utils.register_class(ArmoryOpenProjectFolderButton)
|
||||
bpy.utils.register_class(ArmoryCheckUpdatesButton)
|
||||
bpy.utils.register_class(ArmoryManualButton)
|
||||
bpy.utils.register_class(ArmoryReportIssueButton)
|
||||
bpy.utils.register_class(ArmoryKodeStudioButton)
|
||||
bpy.utils.register_class(CleanMenu)
|
||||
bpy.utils.register_class(CleanButtonMenu)
|
||||
bpy.utils.register_class(ArmoryCleanCacheButton)
|
||||
bpy.utils.register_class(ArmoryCleanProjectButton)
|
||||
bpy.utils.register_class(ArmoryPublishButton)
|
||||
bpy.utils.register_class(ArmoryRenderButton)
|
||||
|
||||
bpy.types.VIEW3D_HT_header.append(draw_view3d_header)
|
||||
bpy.types.INFO_HT_header.prepend(draw_info_header)
|
||||
|
||||
def unregister():
|
||||
bpy.types.VIEW3D_HT_header.remove(draw_view3d_header)
|
||||
bpy.types.INFO_HT_header.remove(draw_info_header)
|
||||
bpy.utils.unregister_module(__name__)
|
||||
|
||||
bpy.utils.unregister_class(ObjectPropsPanel)
|
||||
bpy.utils.unregister_class(ModifiersPropsPanel)
|
||||
bpy.utils.unregister_class(PhysicsPropsPanel)
|
||||
bpy.utils.unregister_class(DataPropsPanel)
|
||||
bpy.utils.unregister_class(ScenePropsPanel)
|
||||
bpy.utils.unregister_class(InvalidateCacheButton)
|
||||
bpy.utils.unregister_class(InvalidateMaterialCacheButton)
|
||||
bpy.utils.unregister_class(InvalidateGPCacheButton)
|
||||
bpy.utils.unregister_class(MaterialPropsPanel)
|
||||
bpy.utils.unregister_class(WorldPropsPanel)
|
||||
bpy.utils.unregister_class(ArmoryPlayerPanel)
|
||||
bpy.utils.unregister_class(ArmoryProjectPanel)
|
||||
bpy.utils.unregister_class(ArmoryPlayButton)
|
||||
bpy.utils.unregister_class(ArmoryPlayInViewportButton)
|
||||
bpy.utils.unregister_class(ArmoryStopButton)
|
||||
bpy.utils.unregister_class(ArmoryBuildButton)
|
||||
bpy.utils.unregister_class(ArmoryBuildProjectButton)
|
||||
bpy.utils.unregister_class(ArmoryPatchButton)
|
||||
bpy.utils.unregister_class(ArmoryOpenProjectFolderButton)
|
||||
bpy.utils.unregister_class(ArmoryCheckUpdatesButton)
|
||||
bpy.utils.unregister_class(ArmoryManualButton)
|
||||
bpy.utils.unregister_class(ArmoryReportIssueButton)
|
||||
bpy.utils.unregister_class(ArmoryKodeStudioButton)
|
||||
bpy.utils.unregister_class(CleanMenu)
|
||||
bpy.utils.unregister_class(CleanButtonMenu)
|
||||
bpy.utils.unregister_class(ArmoryCleanCacheButton)
|
||||
bpy.utils.unregister_class(ArmoryCleanProjectButton)
|
||||
bpy.utils.unregister_class(ArmoryPublishButton)
|
||||
bpy.utils.unregister_class(ArmoryRenderButton)
|
|
@ -2,14 +2,13 @@
|
|||
import bpy
|
||||
from bpy.types import Header
|
||||
from bpy.app.translations import contexts as i18n_contexts
|
||||
import armutils
|
||||
import make
|
||||
import make_state as state
|
||||
import log
|
||||
import arm.utils
|
||||
import arm.make as make
|
||||
import arm.make_state as state
|
||||
import arm.log as log
|
||||
|
||||
class ArmorySpaceHeader(Header):
|
||||
bl_space_type = 'VIEW_ARMORY'
|
||||
info_text = ''
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
@ -25,7 +24,7 @@ class ArmorySpaceHeader(Header):
|
|||
else:
|
||||
row.operator('arm.space_pause', icon="PAUSE")
|
||||
|
||||
layout.label(ArmorySpaceHeader.info_text)
|
||||
layout.label(log.header_info_text)
|
||||
|
||||
class ArmorySpaceStopButton(bpy.types.Operator):
|
||||
'''Switch back to 3D view'''
|
||||
|
@ -60,9 +59,15 @@ class ArmorySpaceResumeButton(bpy.types.Operator):
|
|||
return{'FINISHED'}
|
||||
|
||||
def register():
|
||||
if armutils.with_krom():
|
||||
bpy.utils.register_module(__name__)
|
||||
if arm.utils.with_krom():
|
||||
bpy.utils.register_class(ArmorySpaceHeader)
|
||||
bpy.utils.register_class(ArmorySpaceStopButton)
|
||||
bpy.utils.register_class(ArmorySpacePauseButton)
|
||||
bpy.utils.register_class(ArmorySpaceResumeButton)
|
||||
|
||||
def unregister():
|
||||
if armutils.with_krom():
|
||||
bpy.utils.unregister_module(__name__)
|
||||
if arm.utils.with_krom():
|
||||
bpy.utils.unregister_class(ArmorySpaceHeader)
|
||||
bpy.utils.unregister_class(ArmorySpaceStopButton)
|
||||
bpy.utils.unregister_class(ArmorySpacePauseButton)
|
||||
bpy.utils.unregister_class(ArmorySpaceResumeButton)
|
|
@ -2,22 +2,22 @@ import bpy
|
|||
import json
|
||||
import os
|
||||
import glob
|
||||
import armlib.umsgpack
|
||||
import platform
|
||||
import zipfile
|
||||
import re
|
||||
import arm.lib.umsgpack
|
||||
|
||||
def write_arm(filepath, output):
|
||||
if filepath.endswith('.zip'):
|
||||
with zipfile.ZipFile(filepath, 'w', zipfile.ZIP_DEFLATED) as zip_file:
|
||||
if bpy.data.worlds['Arm'].arm_minimize:
|
||||
zip_file.writestr('data.arm', armlib.umsgpack.dumps(output))
|
||||
zip_file.writestr('data.arm', arm.lib.umsgpack.dumps(output))
|
||||
else:
|
||||
zip_file.writestr('data.arm', json.dumps(output, sort_keys=True, indent=4))
|
||||
else:
|
||||
if bpy.data.worlds['Arm'].arm_minimize:
|
||||
with open(filepath, 'wb') as f:
|
||||
f.write(armlib.umsgpack.dumps(output))
|
||||
f.write(arm.lib.umsgpack.dumps(output))
|
||||
else:
|
||||
with open(filepath, 'w') as f:
|
||||
f.write(json.dumps(output, sort_keys=True, indent=4))
|
|
@ -1,8 +1,8 @@
|
|||
import bpy
|
||||
import os
|
||||
import assets
|
||||
import armutils
|
||||
import make_state as state
|
||||
import arm.utils
|
||||
import arm.assets as assets
|
||||
import arm.make_state as state
|
||||
|
||||
def add_armory_library(sdk_path, name):
|
||||
return ('project.addLibrary("' + sdk_path + '/' + name + '");\n').replace('\\', '/')
|
||||
|
@ -10,7 +10,7 @@ def add_armory_library(sdk_path, name):
|
|||
# Write khafile.js
|
||||
def write_khafilejs(is_play, export_physics, export_navigation, dce_full=False):
|
||||
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
|
||||
# Merge duplicates and sort
|
||||
shader_references = sorted(list(set(assets.shaders)))
|
||||
|
@ -112,8 +112,8 @@ project.addSources('Sources');
|
|||
# Write Main.hx
|
||||
def write_main(is_play, in_viewport, is_publish):
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
resx, resy = armutils.get_render_resolution(armutils.get_active_scene())
|
||||
scene_name = armutils.get_project_scene_name()
|
||||
resx, resy = arm.utils.get_render_resolution(arm.utils.get_active_scene())
|
||||
scene_name = arm.utils.get_project_scene_name()
|
||||
scene_ext = '.zip' if (bpy.data.scenes[scene_name].data_compressed and is_publish) else ''
|
||||
#if not os.path.isfile('Sources/Main.hx'):
|
||||
with open('Sources/Main.hx', 'w') as f:
|
||||
|
@ -158,7 +158,7 @@ class Main {
|
|||
|
||||
f.write("""
|
||||
iron.Scene.setActive(projectScene, function(object:iron.object.Object) {""")
|
||||
# if armutils.with_krom() and in_viewport and is_play:
|
||||
# if arm.utils.with_krom() and in_viewport and is_play:
|
||||
if is_play:
|
||||
f.write("""
|
||||
object.addTrait(new armory.trait.internal.SpaceArmory());""")
|
||||
|
@ -338,7 +338,7 @@ const vec3 voxelgiDimensions = ivec3(""" + str(round(wrd.generate_voxelgi_dimens
|
|||
|
||||
def write_traithx(class_name):
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
package_path = armutils.get_fp() + '/Sources/' + wrd.arm_project_package
|
||||
package_path = arm.utils.get_fp() + '/Sources/' + wrd.arm_project_package
|
||||
if not os.path.exists(package_path):
|
||||
os.makedirs(package_path)
|
||||
with open(package_path + '/' + class_name + '.hx', 'w') as f:
|
|
@ -4,8 +4,8 @@ import sys
|
|||
import subprocess
|
||||
import json
|
||||
import re
|
||||
import armutils
|
||||
import assets
|
||||
import arm.utils
|
||||
import arm.assets as assets
|
||||
|
||||
def add_irr_assets(output_file_irr):
|
||||
assets.add(output_file_irr + '.arm')
|
||||
|
@ -22,7 +22,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
if not os.path.exists(envpath):
|
||||
os.makedirs(envpath)
|
||||
|
||||
base_name = armutils.extract_filename(image_filepath).rsplit('.', 1)[0]
|
||||
base_name = arm.utils.extract_filename(image_filepath).rsplit('.', 1)[0]
|
||||
|
||||
# Assets to be generated
|
||||
output_file_irr = envpath + '/' + base_name + '_irradiance'
|
||||
|
@ -40,12 +40,12 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
return cached_num_mips
|
||||
|
||||
# Get paths
|
||||
sdk_path = armutils.get_sdk_path()
|
||||
sdk_path = arm.utils.get_sdk_path()
|
||||
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
cmft_path = sdk_path + '/armory/tools/cmft/cmft.exe'
|
||||
kraffiti_path = sdk_path + '/win32/Kha/Kore/Tools/kraffiti/kraffiti.exe'
|
||||
elif armutils.get_os() == 'mac':
|
||||
elif arm.utils.get_os() == 'mac':
|
||||
cmft_path = '"' + sdk_path + '/armory/tools/cmft/cmft-osx"'
|
||||
kraffiti_path = '"' + sdk_path + '/Kode Studio.app/Contents/Kha/Kore/Tools/kraffiti/kraffiti-osx"'
|
||||
else:
|
||||
|
@ -53,7 +53,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
kraffiti_path = '"' + sdk_path + '/linux64/Kha/Kore/Tools/kraffiti/kraffiti-linux64"'
|
||||
|
||||
output_gama_numerator = '1.0' if disable_hdr else '2.2'
|
||||
input_file = armutils.safe_assetpath(image_filepath)
|
||||
input_file = arm.utils.safe_assetpath(image_filepath)
|
||||
|
||||
# Scale map
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
|
@ -61,7 +61,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
target_h = int(target_w / 2)
|
||||
scaled_file = output_file_rad + '.' + rad_format
|
||||
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
output = subprocess.check_output([ \
|
||||
kraffiti_path,
|
||||
'from=' + input_file.replace(' ', '\ '),
|
||||
|
@ -88,7 +88,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
# ' --outputGammaDenominator ' + output_gama_numerator
|
||||
|
||||
# Irradiance spherical harmonics
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
subprocess.call([ \
|
||||
cmft_path,
|
||||
'--input', scaled_file.replace(' ', '\ '),
|
||||
|
@ -125,7 +125,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
|
||||
use_opencl = 'true' if wrd.arm_gpu_processing else 'false'
|
||||
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
subprocess.call([ \
|
||||
cmft_path,
|
||||
'--input', input_file.replace(' ', '\ '),
|
||||
|
@ -198,7 +198,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
# Convert to jpgs
|
||||
if disable_hdr is True:
|
||||
for f in generated_files:
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
subprocess.call([ \
|
||||
kraffiti_path,
|
||||
'from=' + f + '.hdr',
|
||||
|
@ -216,7 +216,7 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
for i in range (0, 2):
|
||||
last = generated_files[-1]
|
||||
out = output_file_rad + '_' + str(mip_count + i)
|
||||
if armutils.get_os() == 'win':
|
||||
if arm.utils.get_os() == 'win':
|
||||
subprocess.call([ \
|
||||
kraffiti_path,
|
||||
'from=' + last + '.' + rad_format,
|
||||
|
@ -253,7 +253,7 @@ def sh_to_json(sh_file):
|
|||
|
||||
sh_json = {}
|
||||
sh_json['irradiance'] = irradiance_floats
|
||||
armutils.write_arm(sh_file + '.arm', sh_json)
|
||||
arm.utils.write_arm(sh_file + '.arm', sh_json)
|
||||
|
||||
# Clean up .c
|
||||
os.remove(sh_file + '.c')
|
||||
|
@ -283,7 +283,7 @@ def write_sky_irradiance(base_name):
|
|||
|
||||
sh_json = {}
|
||||
sh_json['irradiance'] = irradiance_floats
|
||||
armutils.write_arm(output_file + '.arm', sh_json)
|
||||
arm.utils.write_arm(output_file + '.arm', sh_json)
|
||||
|
||||
assets.add(output_file + '.arm')
|
||||
|
||||
|
@ -301,6 +301,6 @@ def write_color_irradiance(base_name, col):
|
|||
|
||||
sh_json = {}
|
||||
sh_json['irradiance'] = irradiance_floats
|
||||
armutils.write_arm(output_file + '.arm', sh_json)
|
||||
arm.utils.write_arm(output_file + '.arm', sh_json)
|
||||
|
||||
assets.add(output_file + '.arm')
|
100
blender/start.py
100
blender/start.py
|
@ -1,59 +1,61 @@
|
|||
import make
|
||||
import nodes_logic
|
||||
import nodes_renderpath
|
||||
import props_traits_action
|
||||
import props_traits_clip
|
||||
import props_traits_library
|
||||
import props_traits_params
|
||||
import props_traits
|
||||
import props_lod
|
||||
import props_navigation
|
||||
import props
|
||||
import props_ui
|
||||
import props_renderer
|
||||
import handlers
|
||||
import space_armory
|
||||
import armutils
|
||||
import keymap
|
||||
import arm.nodes_logic
|
||||
import arm.nodes_renderpath
|
||||
import arm.make_renderer
|
||||
import arm.props_traits_action
|
||||
import arm.props_traits_clip
|
||||
import arm.props_traits_library
|
||||
import arm.props_traits_params
|
||||
import arm.props_traits
|
||||
import arm.props_lod
|
||||
import arm.props_navigation
|
||||
import arm.props
|
||||
import arm.props_ui
|
||||
import arm.props_renderer
|
||||
import arm.handlers
|
||||
import arm.space_armory
|
||||
import arm.utils
|
||||
import arm.keymap
|
||||
|
||||
registered = False
|
||||
|
||||
def register():
|
||||
global registered
|
||||
registered = True
|
||||
armutils.register()
|
||||
props_traits_action.register()
|
||||
props_traits_clip.register()
|
||||
props_traits_library.register()
|
||||
props.register()
|
||||
props_ui.register()
|
||||
props_renderer.register()
|
||||
nodes_logic.register()
|
||||
handlers.register()
|
||||
nodes_renderpath.register()
|
||||
props_traits_params.register()
|
||||
props_traits.register()
|
||||
props_lod.register()
|
||||
props_navigation.register()
|
||||
space_armory.register()
|
||||
keymap.register()
|
||||
arm.utils.register()
|
||||
arm.props_traits_action.register()
|
||||
arm.props_traits_clip.register()
|
||||
arm.props_traits_library.register()
|
||||
arm.props.register()
|
||||
arm.props_ui.register()
|
||||
arm.props_renderer.register()
|
||||
arm.nodes_logic.register()
|
||||
arm.handlers.register()
|
||||
arm.nodes_renderpath.register()
|
||||
arm.make_renderer.register()
|
||||
arm.props_traits_params.register()
|
||||
arm.props_traits.register()
|
||||
arm.props_lod.register()
|
||||
arm.props_navigation.register()
|
||||
arm.space_armory.register()
|
||||
arm.keymap.register()
|
||||
|
||||
def unregister():
|
||||
global registered
|
||||
registered = False
|
||||
keymap.unregister()
|
||||
armutils.unregister()
|
||||
nodes_logic.unregister()
|
||||
nodes_renderpath.unregister()
|
||||
props_traits_params.unregister()
|
||||
props_traits.unregister()
|
||||
props_lod.unregister()
|
||||
props_navigation.unregister()
|
||||
handlers.unregister()
|
||||
props_renderer.unregister()
|
||||
props_ui.unregister()
|
||||
props.unregister()
|
||||
props_traits_action.unregister()
|
||||
props_traits_clip.unregister()
|
||||
props_traits_library.unregister()
|
||||
space_armory.unregister()
|
||||
arm.keymap.unregister()
|
||||
arm.utils.unregister()
|
||||
arm.nodes_logic.unregister()
|
||||
arm.make_renderer.unregister()
|
||||
arm.nodes_renderpath.unregister()
|
||||
arm.props_traits_params.unregister()
|
||||
arm.props_traits.unregister()
|
||||
arm.props_lod.unregister()
|
||||
arm.props_navigation.unregister()
|
||||
arm.handlers.unregister()
|
||||
arm.props_renderer.unregister()
|
||||
arm.props_ui.unregister()
|
||||
arm.props.unregister()
|
||||
arm.props_traits_action.unregister()
|
||||
arm.props_traits_clip.unregister()
|
||||
arm.props_traits_library.unregister()
|
||||
arm.space_armory.unregister()
|
||||
|
|
Loading…
Reference in a new issue