Safe checks, fix path importing.
This commit is contained in:
parent
33a3974961
commit
4e9a10ddf8
|
@ -105,7 +105,7 @@ def safefilename(s):
|
|||
return s
|
||||
|
||||
def safe_assetpath(s):
|
||||
return s[2:] # Remove leading '//'
|
||||
return s[2:] if s[:2] == '//' else s # Remove leading '//'
|
||||
|
||||
def extract_filename(s):
|
||||
return os.path.basename(s)
|
||||
|
|
|
@ -1993,7 +1993,7 @@ class ArmoryExporter:
|
|||
o['shadows_bias'] = objref.lamp_shadows_bias
|
||||
if o['type'] == 'sun': # Scale bias for ortho light matrix
|
||||
o['shadows_bias'] *= 10.0
|
||||
if objref.shadow_soft_size != 0.1:
|
||||
if objtype != 'HEMI' and objref.shadow_soft_size != 0.1:
|
||||
o['lamp_size'] = objref.shadow_soft_size
|
||||
|
||||
# Parse nodes
|
||||
|
@ -2347,7 +2347,7 @@ class ArmoryExporter:
|
|||
|
||||
def get_export_tangents(self, mesh):
|
||||
for m in mesh.materials:
|
||||
if m.export_tangents == True:
|
||||
if m != None and m.export_tangents == True:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import armutils
|
|||
import make
|
||||
import make_state as state
|
||||
import space_armory
|
||||
import nodes_renderpath
|
||||
import time
|
||||
import bridge
|
||||
import log
|
||||
|
@ -117,13 +118,14 @@ def on_scene_update_post(context):
|
|||
|
||||
obj = bpy.context.object
|
||||
if obj != None and operators_changed:
|
||||
# Modifier was added, recache mesh
|
||||
# Modifier was added/removed, recache mesh
|
||||
if ops[-1].bl_idname == 'OBJECT_OT_modifier_add' or ops[-1].bl_idname == 'OBJECT_OT_modifier_remove':
|
||||
obj.data.mesh_cached = False
|
||||
|
||||
@persistent
|
||||
def on_load_post(context):
|
||||
props.init_properties_on_load()
|
||||
nodes_renderpath.reload_blend_data()
|
||||
|
||||
@persistent
|
||||
def on_save_pre(context):
|
||||
|
|
|
@ -138,7 +138,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
wrd = bpy.data.worlds['Arm']
|
||||
|
||||
# Env map included
|
||||
if node.type == 'TEX_ENVIRONMENT':
|
||||
if node.type == 'TEX_ENVIRONMENT' and node.image != None:
|
||||
envmap_strength_const['float'] *= 2.0 # Match to cycles
|
||||
|
||||
tex = {}
|
||||
|
|
|
@ -869,7 +869,6 @@ def register():
|
|||
bpy.utils.register_module(__name__)
|
||||
try:
|
||||
nodeitems_utils.register_node_categories("CG_PIPELINE_NODES", node_categories)
|
||||
reload_blend_data()
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ def write_probes(image_filepath, disable_hdr, cached_num_mips, generate_radiance
|
|||
kraffiti_path = sdk_path + '/linux64/resources/app/extensions/kha/Kha/Kore/Tools/kraffiti/kraffiti-linux64'
|
||||
|
||||
output_gama_numerator = '1.0' if disable_hdr else '2.2'
|
||||
input_file = image_filepath[2:] # Remove leading //
|
||||
input_file = armutils.safe_assetpath(image_filepath)
|
||||
|
||||
# Scale map
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
target_w = int(wrd.generate_radiance_size)
|
||||
target_h = target_w / 2
|
||||
target_h = int(target_w / 2)
|
||||
scaled_file = output_file_rad + '.' + rad_format
|
||||
|
||||
if armutils.get_os() == 'win':
|
||||
|
|
Loading…
Reference in a new issue