Custom shaders
This commit is contained in:
parent
f4ff7ffb79
commit
6b46342519
|
@ -2287,7 +2287,7 @@ class ArmoryExporter:
|
|||
if material.arm_two_sided or wrd.arm_culling == False:
|
||||
o['override_context'] = {}
|
||||
o['override_context']['cull_mode'] = 'none'
|
||||
elif material.arm_cull_mode != 'Clockwise':
|
||||
elif material.arm_cull_mode != 'clockwise':
|
||||
o['override_context'] = {}
|
||||
o['override_context']['cull_mode'] = material.arm_cull_mode
|
||||
|
||||
|
|
|
@ -26,10 +26,30 @@ def parse(material, mat_data, mat_users, mat_armusers):
|
|||
rpdat = arm.utils.get_rp()
|
||||
|
||||
# No batch - shader data per material
|
||||
if not wrd.arm_batch_materials or material.name.startswith('armdefault'):
|
||||
if material.arm_custom_material != '':
|
||||
rpasses = ['mesh']
|
||||
sd = {}
|
||||
sd['contexts'] = []
|
||||
con = {}
|
||||
con['vertex_structure'] = []
|
||||
elem = {}
|
||||
elem['name'] = 'pos'
|
||||
con['vertex_structure'].append(elem)
|
||||
elem = {}
|
||||
elem['name'] = 'nor'
|
||||
con['vertex_structure'].append(elem)
|
||||
sd['contexts'].append(con)
|
||||
shader_data_name = material.arm_custom_material
|
||||
bind_constants = {}
|
||||
bind_constants['mesh'] = []
|
||||
bind_textures = {}
|
||||
bind_textures['mesh'] = []
|
||||
elif not wrd.arm_batch_materials or material.name.startswith('armdefault'):
|
||||
rpasses, shader_data, shader_data_name, bind_constants, bind_textures = make_shader.build(material, mat_users, mat_armusers)
|
||||
sd = shader_data.sd
|
||||
else:
|
||||
rpasses, shader_data, shader_data_name, bind_constants, bind_textures = mat_batch.get(material)
|
||||
sd = shader_data.sd
|
||||
|
||||
# Material
|
||||
for rp in rpasses:
|
||||
|
@ -96,4 +116,4 @@ def parse(material, mat_data, mat_users, mat_armusers):
|
|||
|
||||
mat_data['shader'] = shader_data_name + '/' + shader_data_name
|
||||
|
||||
return shader_data.sd, rpasses
|
||||
return sd, rpasses
|
||||
|
|
|
@ -282,6 +282,7 @@ def init_properties():
|
|||
bpy.types.Material.arm_tess_shadows = bpy.props.BoolProperty(name="Tess Shadows", description="Use tessellation shaders when rendering shadow maps", default=True)
|
||||
bpy.types.Material.arm_tess_shadows_inner = bpy.props.IntProperty(name="Inner", description="Inner tessellation level for shadows", default=7)
|
||||
bpy.types.Material.arm_tess_shadows_outer = bpy.props.IntProperty(name="Outer", description="Outer tessellation level for shadows", default=7)
|
||||
bpy.types.Material.arm_custom_material = bpy.props.StringProperty(name="Custom Material", description="Write custom material", default='')
|
||||
# For scene
|
||||
bpy.types.Scene.arm_export = bpy.props.BoolProperty(name="Export", description="Export scene data", default=True)
|
||||
bpy.types.Scene.arm_gp_export = bpy.props.BoolProperty(name="Export GP", description="Export grease pencil data", default=True)
|
||||
|
|
|
@ -241,6 +241,8 @@ class MaterialPropsPanel(bpy.types.Panel):
|
|||
columnb.prop(mat, 'arm_tess_shadows_inner')
|
||||
columnb.prop(mat, 'arm_tess_shadows_outer')
|
||||
|
||||
layout.prop(mat, 'arm_custom_material')
|
||||
|
||||
layout.operator("arm.invalidate_material_cache")
|
||||
|
||||
class WorldPropsPanel(bpy.types.Panel):
|
||||
|
|
|
@ -57,6 +57,11 @@ project.addSources('Sources');
|
|||
if os.path.isfile(file):
|
||||
assets.add(file)
|
||||
|
||||
if os.path.exists('Shaders'):
|
||||
for file in glob.glob("Shaders/**", recursive=True):
|
||||
if os.path.isfile(file):
|
||||
assets.add_shader(file)
|
||||
|
||||
if not os.path.exists('Libraries/armory'):
|
||||
f.write(add_armory_library(sdk_path, 'armory'))
|
||||
|
||||
|
|
Loading…
Reference in a new issue