[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4697] contrib/py/scripts/addons/ io_scene_fpx: added texture material for cycles render engine
Alexander N
alpha-beta-release at gmx.net
Sat Aug 24 01:07:00 CEST 2013
Revision: 4697
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4697
Author: beta-tester
Date: 2013-08-23 23:07:00 +0000 (Fri, 23 Aug 2013)
Log Message:
-----------
added texture material for cycles render engine
Modified Paths:
--------------
contrib/py/scripts/addons/io_scene_fpx/__init__.py
contrib/py/scripts/addons/io_scene_fpx/fpx_import.py
Modified: contrib/py/scripts/addons/io_scene_fpx/__init__.py
===================================================================
--- contrib/py/scripts/addons/io_scene_fpx/__init__.py 2013-08-23 19:37:15 UTC (rev 4696)
+++ contrib/py/scripts/addons/io_scene_fpx/__init__.py 2013-08-23 23:07:00 UTC (rev 4697)
@@ -34,7 +34,7 @@
'name': "Future Pinball FPx format (.fpm/.fpl/.fpt)",
'description': "Import Future Pinball Model, Library and Table files",
'author': "Alexander Nussbaumer",
- 'version': (0, 0, 0, '2013-08-23'),
+ 'version': (0, 0, 0, '2013-08-24'),
'blender': (2, 68, 0),
'location': "File > Import",
'warning': "",
Modified: contrib/py/scripts/addons/io_scene_fpx/fpx_import.py
===================================================================
--- contrib/py/scripts/addons/io_scene_fpx/fpx_import.py 2013-08-23 19:37:15 UTC (rev 4696)
+++ contrib/py/scripts/addons/io_scene_fpx/fpx_import.py 2013-08-23 23:07:00 UTC (rev 4697)
@@ -933,8 +933,9 @@
blender_material.use_transparent_shadows = True
blender_material.alpha = 0.0
render_engine = self.__context.scene.render.engine
+
#blender internal
- #self.__context.scene.render.engine = 'BLENDER_RENDER'
+ self.__context.scene.render.engine = 'BLENDER_RENDER'
if uv_layer:
bt_name = "uv_{}".format(FORMAT_TEXTURE.format(fpx_image_name))
else:
@@ -952,31 +953,49 @@
tex_slot.uv_layer = uv_layer
#blender_material.use_shadeless = True #DEBUG
- """
# blender cycles
self.__context.scene.render.engine = 'CYCLES'
blender_material.use_nodes = True
- blender_material = self.__blend_data.materials.get(blender_material.name)
- node_0 = blender_material.node_tree.nodes.new('OUTPUT_MATERIAL')
- node_1 = blender_material.node_tree.nodes.new('BSDF_GLOSSY')
- node_1.inputs['Roughness'].default_value = 0.25
- link1_0 = blender_material.node_tree.links.new(node_1.outputs['BSDF'], node_0.inputs['Surface'])
- node_2 = blender_material.node_tree.nodes.new('TEX_IMAGE')
- node_2.image = blender_image
- link2_1 = blender_material.node_tree.links.new(node_2.outputs['Color'], node_1.inputs['Color'])
- node_3 = blender_material.node_tree.nodes.new('TEX_COORD')
+ nodes = blender_material.node_tree.nodes
+ links = blender_material.node_tree.links
+ gap = 50.0
+ nodes.clear()
+ node0 = nodes.new('ShaderNodeOutputMaterial')
+ node1 = nodes.new('ShaderNodeMixShader')
+ node2 = nodes.new('ShaderNodeBsdfTranslucent')
+ node2.inputs['Color'].default_value = (1.0, 1.0, 1.0, 1.0)
+ node3 = nodes.new('ShaderNodeBsdfGlossy')
+ node3.inputs['Roughness'].default_value = 0.25
+ node4 = nodes.new('ShaderNodeTexImage')
+ node4.image = blender_image
+ node5 = nodes.new('ShaderNodeTexCoord')
+
+ node5.location = (0.0, 0.0)
+ node4.location = (node5.location.x + node5.width + gap, 0.0)
+ node3.location = (node4.location.x + node4.width + gap, 0.0)
+ node2.location = (node3.location.x + node3.width + gap, 0.0)
+ node1.location = (node2.location.x + node2.width + gap, 0.0)
+ node0.location = (node1.location.x + node1.width + gap, 0.0)
+
+ link1_0 = links.new(node1.outputs['Shader'], node0.inputs['Surface'])
+ link4_1a = links.new(node4.outputs['Alpha'], node1.inputs[0]) # Fac
+ link2_1b = links.new(node2.outputs['BSDF'], node1.inputs[1]) # 2'nd Shader
+ link3_1c = links.new(node3.outputs['BSDF'], node1.inputs[2]) # 1'st Shader
+ link4_3 = links.new(node4.outputs['Color'], node3.inputs['Color'])
if uv_layer:
- out3 = node_3.outputs['UV']
+ link5_4 = links.new(node5.outputs['UV'], node4.inputs['Vector'])
else:
- out3 = node_3.outputs['Generated']
- link3_2 = blender_material.node_tree.links.new(out3, node_2.inputs['Vector'])
+ link5_4 = links.new(node5.outputs['Generated'], node4.inputs['Vector'])
+ if render_engine != 'CYCLES':
+ blender_material.use_nodes = False
+ """
# blender game
self.__context.scene.render.engine = 'BLENDER_GAME'
#TODO
+ """
self.__context.scene.render.engine = render_engine
- """
blender_object.data.materials.append(blender_material)
More information about the Bf-extensions-cvs
mailing list