This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Blender 質感・マテリアル設定実践テクニック 3-02-1.blend | |
import bpy | |
object = bpy.data.objects['export3dcoat'] # シーンに配置済みのオブジェクト | |
slot = object.material_slots[0] # そのマテリアルスロット | |
material = slot.material # に設定されているマテリアル | |
node_tree = material.node_tree # のノードネットワーク | |
nodes = node_tree.nodes # にある各ノード | |
def delete(): | |
"""過去に生成したノードを削除します。""" | |
for node in nodes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BlenderユーザーのためのPython入門 | |
# 第24節 複数のキューブをsinで並べてグラデーションする | |
import colorsys | |
import bpy | |
import math | |
import random | |
def delete_all(): | |
"""既存のメッシュとマテリアルを削除します。""" | |
for mesh in bpy.data.meshes: | |
assert isinstance(mesh, bpy.types.Mesh) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BlenderユーザーのためのPython入門 | |
# 第23節 トーラスの各面にマテリアルインデックスをセットする | |
import bmesh | |
import bpy | |
import random | |
def delete_all(): | |
"""既存のメッシュとマテリアルを削除します。""" | |
for mesh in bpy.data.meshes: | |
assert isinstance(mesh, bpy.types.Mesh) | |
bpy.data.meshes.remove(mesh) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BlenderユーザーのためのPython入門 | |
# 第22節 ランダムな色の複数の球を並べる | |
import bpy | |
import random | |
def delete_all(): | |
"""既存のメッシュとマテリアルを削除します。""" | |
for mesh in bpy.data.meshes: | |
assert isinstance(mesh, bpy.types.Mesh) | |
bpy.data.meshes.remove(mesh) | |
for material in bpy.data.materials: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Blender 質感・マテリアル設定実践テクニック 2-02-1.blend | |
import bpy | |
def init_engine(): | |
"""レンダリングエンジンの設定をします。""" | |
bpy.context.scene.render.engine = 'CYCLES' | |
bpy.context.scene.cycles.samples = 1_024 | |
def init_material(): | |
"""マテリアルの設定をします。""" | |
material = bpy.data.materials['Material'] | |
assert isinstance(material, bpy.types.Material) |
NewerOlder