PlantFactory → Blender Cycles 用
使い方:
①Blenderで、PlantFactoryからfbxエクスポートした植物オブジェクトををShiftキーを押しながら一つ以上選択します。
②このスクリプトを走らせます
import bpy for obj in bpy.context.selected_objects: for mat in obj.data.materials: thisTree = mat.node_tree; thisTreeNodes = mat.node_tree.nodes for node in thisTreeNodes: if node.type == 'TEX_IMAGE': if 'alpha' in node.image.name: # ex. 'alpha map.016' alphaTex = node colorout = alphaTex.outputs['Color'] alphaout = alphaTex.outputs['Alpha'] if alphaout.is_linked: MixNode = alphaout.links[0].to_node MixColor1in = MixNode.inputs['Color1'] MixColor2in = MixNode.inputs['Color2'] thisTree.links.new( colorout , MixColor1in ) thisTree.links.new( alphaout , MixColor2in )