Improve linked data.
This commit is contained in:
parent
5678b6b027
commit
0f7ea897ca
|
@ -5,7 +5,7 @@ precision mediump float;
|
|||
#endif
|
||||
|
||||
#include "../compiled.glsl"
|
||||
//const float bloomTreshold = 3.0;
|
||||
//const float bloomThreshold = 3.0;
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform vec2 texStep;
|
||||
|
@ -23,7 +23,7 @@ void main() {
|
|||
col /= 4.0;
|
||||
|
||||
float brightness = dot(col.rgb, vec3(0.2126, 0.7152, 0.0722));
|
||||
if (brightness > bloomTreshold) {
|
||||
if (brightness > bloomThreshold) {
|
||||
fragColor.rgb = vec3(col.rgb);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ uniform sampler3D voxels;
|
|||
const float voxelGridWorldSize = 150.0;
|
||||
const int voxelDimensions = 512;
|
||||
const float maxDist = 30.0;
|
||||
const float alphaTreshold = 0.95;
|
||||
const float alphaThreshold = 0.95;
|
||||
const int numCones = 6;
|
||||
vec3 coneDirections[6] = vec3[](
|
||||
vec3(0, 1, 0),
|
||||
|
@ -29,7 +29,7 @@ vec4 coneTrace(vec3 posWorld, vec3 direction, vec3 norWorld, float tanHalfAngle,
|
|||
vec3 color = vec3(0.0);
|
||||
float alpha = 0.0;
|
||||
occlusion = 0.0;
|
||||
while (dist < maxDist && alpha < alphaTreshold) {
|
||||
while (dist < maxDist && alpha < alphaThreshold) {
|
||||
// Smallest sample diameter possible is the voxel size
|
||||
float diameter = max(voxelWorldSize, 2.0 * tanHalfAngle * dist);
|
||||
float lodLevel = log2(diameter / voxelWorldSize);
|
||||
|
|
|
@ -5,6 +5,7 @@ import glob
|
|||
import lib.umsgpack
|
||||
import platform
|
||||
import zipfile
|
||||
import re
|
||||
|
||||
def write_arm(filepath, output):
|
||||
if filepath.endswith('.zip'):
|
||||
|
@ -98,11 +99,16 @@ def color_to_int(val):
|
|||
def safe_filename(s):
|
||||
return s
|
||||
|
||||
def safefilename(s):
|
||||
for c in r'[]/\;,><&*:%=+@!#^()|?^':
|
||||
s = s.replace(c, '-')
|
||||
return s
|
||||
|
||||
def safe_assetpath(s):
|
||||
return s[2:] # Remove leading '//'
|
||||
|
||||
def extract_filename(s):
|
||||
return s.rsplit(os.path.sep, 1)[1]
|
||||
return os.path.basename(s)
|
||||
|
||||
def get_render_resolution(scene_index=0):
|
||||
render = bpy.data.scenes[scene_index].render
|
||||
|
|
|
@ -181,7 +181,7 @@ class ArmoryExporter:
|
|||
k += 1
|
||||
|
||||
count &= 7
|
||||
if (count != 0):
|
||||
if count != 0:
|
||||
for j in range(count - 1):
|
||||
va += self.write_vector3d(getattr(vertex_array[k], attrib))
|
||||
k += 1
|
||||
|
@ -260,8 +260,8 @@ class ArmoryExporter:
|
|||
|
||||
def find_node(self, name):
|
||||
for bobject_ref in self.bobjectArray.items():
|
||||
if (bobject_ref[0].name == name):
|
||||
return (bobject_ref)
|
||||
if bobject_ref[0].name == name:
|
||||
return bobject_ref
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
|
@ -271,34 +271,34 @@ class ArmoryExporter:
|
|||
|
||||
for key in fcurve.keyframe_points:
|
||||
interp = key.interpolation
|
||||
if (interp == "LINEAR"):
|
||||
if interp == "LINEAR":
|
||||
linear_count += 1
|
||||
elif (interp == "BEZIER"):
|
||||
elif interp == "BEZIER":
|
||||
bezier_count += 1
|
||||
else:
|
||||
return (kAnimationSampled)
|
||||
return kAnimationSampled
|
||||
|
||||
if (bezier_count == 0):
|
||||
return (kAnimationLinear)
|
||||
elif (linear_count == 0):
|
||||
return (kAnimationBezier)
|
||||
return (kAnimationSampled)
|
||||
if bezier_count == 0:
|
||||
return kAnimationLinear
|
||||
elif linear_count == 0:
|
||||
return kAnimationBezier
|
||||
return kAnimationSampled
|
||||
|
||||
@staticmethod
|
||||
def animation_keys_different(fcurve):
|
||||
key_count = len(fcurve.keyframe_points)
|
||||
if (key_count > 0):
|
||||
if key_count > 0:
|
||||
key1 = fcurve.keyframe_points[0].co[1]
|
||||
for i in range(1, key_count):
|
||||
key2 = fcurve.keyframe_points[i].co[1]
|
||||
if (math.fabs(key2 - key1) > kExportEpsilon):
|
||||
if math.fabs(key2 - key1) > kExportEpsilon:
|
||||
return True
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def animation_tangents_nonzero(fcurve):
|
||||
key_count = len(fcurve.keyframe_points)
|
||||
if (key_count > 0):
|
||||
if key_count > 0:
|
||||
key = fcurve.keyframe_points[0].co[1]
|
||||
left = fcurve.keyframe_points[0].handle_left[1]
|
||||
right = fcurve.keyframe_points[0].handle_right[1]
|
||||
|
@ -316,7 +316,7 @@ class ArmoryExporter:
|
|||
def matrices_different(m1, m2):
|
||||
for i in range(4):
|
||||
for j in range(4):
|
||||
if (math.fabs(m1[i][j] - m2[i][j]) > kExportEpsilon):
|
||||
if math.fabs(m1[i][j] - m2[i][j]) > kExportEpsilon:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -325,7 +325,7 @@ class ArmoryExporter:
|
|||
path = "pose.bones[\"" + name + "\"]."
|
||||
curve_array = []
|
||||
|
||||
if (armature.animation_data):
|
||||
if armature.animation_data:
|
||||
action = armature.animation_data.action
|
||||
if (action):
|
||||
for fcurve in action.fcurves:
|
||||
|
@ -335,8 +335,8 @@ class ArmoryExporter:
|
|||
|
||||
@staticmethod
|
||||
def animation_present(fcurve, kind):
|
||||
if (kind != kAnimationBezier):
|
||||
return (ArmoryExporter.animation_keys_different(fcurve))
|
||||
if kind != kAnimationBezier:
|
||||
return ArmoryExporter.animation_keys_different(fcurve)
|
||||
return ((ArmoryExporter.animation_keys_different(fcurve)) or (ArmoryExporter.animation_tangents_nonzero(fcurve)))
|
||||
|
||||
@staticmethod
|
||||
|
@ -1094,7 +1094,7 @@ class ArmoryExporter:
|
|||
if ArmoryExporter.option_mesh_only and btype != kNodeTypeMesh:
|
||||
return
|
||||
|
||||
self.bobjectArray[bobject] = {"objectType" : btype, "structName" : bobject.name}
|
||||
self.bobjectArray[bobject] = {"objectType" : btype, "structName" : self.asset_name(bobject)}
|
||||
|
||||
if (bobject.parent_type == "BONE"):
|
||||
boneSubbobjectArray = self.boneParentArray.get(bobject.parent_bone)
|
||||
|
@ -1147,15 +1147,22 @@ class ArmoryExporter:
|
|||
if ((animation) and (poseBone)):
|
||||
self.export_bone_sampled_animation(poseBone, scene, o, action)
|
||||
|
||||
def asset_name(self, bdata):
|
||||
s = bdata.name
|
||||
# Append library name if linked
|
||||
if bdata.library != None:
|
||||
s += '_' + bdata.library.name
|
||||
return s
|
||||
|
||||
def export_material_ref(self, material, index, o):
|
||||
if material == None:
|
||||
return
|
||||
if (not material in self.materialArray):
|
||||
self.materialArray[material] = {"structName" : material.name}
|
||||
if not material in self.materialArray:
|
||||
self.materialArray[material] = {"structName" : self.asset_name(material)}
|
||||
o['material_refs'].append(self.materialArray[material]["structName"])
|
||||
|
||||
def export_particle_system_ref(self, psys, index, o):
|
||||
if (not psys.settings in self.particleSystemArray):
|
||||
if not psys.settings in self.particleSystemArray:
|
||||
self.particleSystemArray[psys.settings] = {"structName" : psys.settings.name}
|
||||
|
||||
pref = {}
|
||||
|
@ -1249,9 +1256,16 @@ class ArmoryExporter:
|
|||
# Export the object reference and material references.
|
||||
objref = bobject.data
|
||||
|
||||
# Remove unsafe chars from data names
|
||||
safe = armutils.safefilename(objref.name)
|
||||
if objref.name != safe:
|
||||
objref.name = safe
|
||||
|
||||
objname = self.asset_name(objref)
|
||||
|
||||
if type == kNodeTypeMesh:
|
||||
if not objref in self.meshArray:
|
||||
self.meshArray[objref] = {"structName" : objref.name, "objectTable" : [bobject]}
|
||||
self.meshArray[objref] = {"structName" : objname, "objectTable" : [bobject]}
|
||||
else:
|
||||
self.meshArray[objref]["objectTable"].append(bobject)
|
||||
|
||||
|
@ -1290,21 +1304,21 @@ class ArmoryExporter:
|
|||
|
||||
elif type == kNodeTypeLamp:
|
||||
if not objref in self.lampArray:
|
||||
self.lampArray[objref] = {"structName" : objref.name, "objectTable" : [bobject]}
|
||||
self.lampArray[objref] = {"structName" : objname, "objectTable" : [bobject]}
|
||||
else:
|
||||
self.lampArray[objref]["objectTable"].append(bobject)
|
||||
o['data_ref'] = self.lampArray[objref]["structName"]
|
||||
|
||||
elif type == kNodeTypeCamera:
|
||||
if not objref in self.cameraArray:
|
||||
self.cameraArray[objref] = {"structName" : objref.name, "objectTable" : [bobject]}
|
||||
self.cameraArray[objref] = {"structName" : objname, "objectTable" : [bobject]}
|
||||
else:
|
||||
self.cameraArray[objref]["objectTable"].append(bobject)
|
||||
o['data_ref'] = self.cameraArray[objref]["structName"]
|
||||
|
||||
elif type == kNodeTypeSpeaker:
|
||||
if not objref in self.speakerArray:
|
||||
self.speakerArray[objref] = {"structName" : objref.name, "objectTable" : [bobject]}
|
||||
self.speakerArray[objref] = {"structName" : objname, "objectTable" : [bobject]}
|
||||
else:
|
||||
self.speakerArray[objref]["objectTable"].append(bobject)
|
||||
o['data_ref'] = self.speakerArray[objref]["structName"]
|
||||
|
@ -1338,7 +1352,8 @@ class ArmoryExporter:
|
|||
action = bobject.animation_data.action
|
||||
|
||||
if armdata and action != None:
|
||||
armatureid = armutils.safe_filename(armdata.name)
|
||||
armatureid = self.asset_name(armdata)
|
||||
armatureid = armutils.safe_filename(armatureid)
|
||||
ext = ''
|
||||
if self.is_compress(armdata):
|
||||
ext = '.zip'
|
||||
|
@ -1700,7 +1715,7 @@ class ArmoryExporter:
|
|||
if self.object_is_mesh_cached(bobject) == True and os.path.exists(fp):
|
||||
return
|
||||
|
||||
print('Exporting mesh ' + bobject.data.name)
|
||||
print('Exporting mesh ' + self.asset_name(bobject.data))
|
||||
|
||||
o = {}
|
||||
o['name'] = oid
|
||||
|
|
|
@ -112,7 +112,7 @@ class EffectsRPDataPropsPanel(bpy.types.Panel):
|
|||
layout.label('Bloom')
|
||||
# layout.prop(wrd, 'generate_bloom')
|
||||
# if wrd.generate_bloom:
|
||||
layout.prop(wrd, 'generate_bloom_treshold')
|
||||
layout.prop(wrd, 'generate_bloom_threshold')
|
||||
layout.prop(wrd, 'generate_bloom_strength')
|
||||
layout.prop(wrd, 'generate_bloom_radius')
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ def init_properties():
|
|||
bpy.types.World.generate_ssao_texture_scale = bpy.props.FloatProperty(name="Texture Scale", default=1.0, min=0.0, max=1.0, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_shadows = bpy.props.BoolProperty(name="Shadows", default=True, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom = bpy.props.BoolProperty(name="Bloom", default=True, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom_treshold = bpy.props.FloatProperty(name="Treshold", default=20.0, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom_threshold = bpy.props.FloatProperty(name="Threshold", default=20.0, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom_strength = bpy.props.FloatProperty(name="Strength", default=0.5, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_bloom_radius = bpy.props.FloatProperty(name="Radius", default=0.5, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_motion_blur = bpy.props.BoolProperty(name="Motion Blur", default=True, update=assets.invalidate_shader_cache)
|
||||
|
|
|
@ -279,7 +279,7 @@ const float ssaoTextureScale = """ + str(round(wrd.generate_ssao_texture_scale *
|
|||
# """)
|
||||
if wrd.generate_bloom:
|
||||
f.write(
|
||||
"""const float bloomTreshold = """ + str(round(wrd.generate_bloom_treshold * 100) / 100) + """;
|
||||
"""const float bloomThreshold = """ + str(round(wrd.generate_bloom_threshold * 100) / 100) + """;
|
||||
const float bloomStrength = """ + str(round(wrd.generate_bloom_strength * 100) / 100) + """;
|
||||
const float bloomRadius = """ + str(round(wrd.generate_bloom_radius * 100) / 100) + """;
|
||||
""")
|
||||
|
|
Loading…
Reference in a new issue