move blend file into a folder and export more variables
This commit is contained in:
parent
d2fc5c2734
commit
e8bb82d2f0
3 changed files with 23 additions and 8 deletions
|
@ -198,12 +198,13 @@ classes = [
|
||||||
|
|
||||||
def import_template():
|
def import_template():
|
||||||
cwd = os.path.dirname(os.path.realpath(__file__))
|
cwd = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
resources_dir = "resources"
|
||||||
blendfile = "BitsquidPBR.blend"
|
blendfile = "BitsquidPBR.blend"
|
||||||
section = "Material"
|
section = "Material"
|
||||||
object = "Stingray Standard"
|
object = "Stingray Standard"
|
||||||
|
|
||||||
filepath = os.path.join(cwd, blendfile, section, object)
|
filepath = os.path.join(cwd, resources_dir, blendfile, section, object)
|
||||||
directory = os.path.join(cwd, blendfile, section)
|
directory = os.path.join(cwd, resources_dir, blendfile, section)
|
||||||
filename = object
|
filename = object
|
||||||
|
|
||||||
bpy.ops.wm.append(
|
bpy.ops.wm.append(
|
||||||
|
|
|
@ -56,27 +56,27 @@ variables = {
|
||||||
}
|
}
|
||||||
use_ao_map = {
|
use_ao_map = {
|
||||||
type = "scalar"
|
type = "scalar"
|
||||||
value = 0
|
value = {{ use_ao_map }}
|
||||||
}
|
}
|
||||||
use_color_map = {
|
use_color_map = {
|
||||||
type = "scalar"
|
type = "scalar"
|
||||||
value = 0
|
value = {{ use_color_map }}
|
||||||
}
|
}
|
||||||
use_emissive_map = {
|
use_emissive_map = {
|
||||||
type = "scalar"
|
type = "scalar"
|
||||||
value = 0
|
value = {{ use_emissive_map }}
|
||||||
}
|
}
|
||||||
use_metallic_map = {
|
use_metallic_map = {
|
||||||
type = "scalar"
|
type = "scalar"
|
||||||
value = 0
|
value = {{ use_metallic_map }}
|
||||||
}
|
}
|
||||||
use_normal_map = {
|
use_normal_map = {
|
||||||
type = "scalar"
|
type = "scalar"
|
||||||
value = 0
|
value = {{ use_normal_map }}
|
||||||
}
|
}
|
||||||
use_roughness_map = {
|
use_roughness_map = {
|
||||||
type = "scalar"
|
type = "scalar"
|
||||||
value = 0
|
value = {{ use_roughness_map }}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,11 +102,19 @@ def save(self, context, material):
|
||||||
|
|
||||||
namespace = {
|
namespace = {
|
||||||
'material': material,
|
'material': material,
|
||||||
|
|
||||||
'base_color': (1, 1, 1),
|
'base_color': (1, 1, 1),
|
||||||
'roughness': 0.0,
|
'roughness': 0.0,
|
||||||
'metallic': 0.0,
|
'metallic': 0.0,
|
||||||
'emissive': (0, 0, 0),
|
'emissive': (0, 0, 0),
|
||||||
'emissive_intensity': 0,
|
'emissive_intensity': 0,
|
||||||
|
|
||||||
|
'use_color_map': 0,
|
||||||
|
'use_roughness_map': 0,
|
||||||
|
'use_metallic_map': 0,
|
||||||
|
'use_emissive_map': 0,
|
||||||
|
'use_ao_map': 0,
|
||||||
|
'use_normal_map': 0
|
||||||
}
|
}
|
||||||
|
|
||||||
nodes = material.node_tree.nodes
|
nodes = material.node_tree.nodes
|
||||||
|
@ -116,6 +124,12 @@ def save(self, context, material):
|
||||||
namespace['metallic'] = nodes["Metallic"].outputs[0].default_value
|
namespace['metallic'] = nodes["Metallic"].outputs[0].default_value
|
||||||
namespace['emissive'] = nodes["Emissive"].outputs[0].default_value
|
namespace['emissive'] = nodes["Emissive"].outputs[0].default_value
|
||||||
namespace['emissive_intensity'] = nodes["Emissive Intensity"].outputs[0].default_value
|
namespace['emissive_intensity'] = nodes["Emissive Intensity"].outputs[0].default_value
|
||||||
|
namespace['use_color_map'] = nodes["Use Color Map"].outputs[0].default_value
|
||||||
|
namespace['use_roughness_map'] = nodes["Use Roughness Map"].outputs[0].default_value
|
||||||
|
namespace['use_metallic_map'] = nodes["Use Metallic Map"].outputs[0].default_value
|
||||||
|
namespace['use_emissive_map'] = nodes["Use Emissive Map"].outputs[0].default_value
|
||||||
|
namespace['use_ao_map'] = nodes["Use AO Map"].outputs[0].default_value
|
||||||
|
namespace['use_normal_map'] = nodes["Use Normal Map"].outputs[0].default_value
|
||||||
except:
|
except:
|
||||||
self.report({'WARNING'}, "Couldn't find Stingray Standard nodes")
|
self.report({'WARNING'}, "Couldn't find Stingray Standard nodes")
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue