2023年8月2日水曜日

20230803a 写真 貼り テスト


写真 貼り テスト













import bpy

import math


def create_circle_on_plane(plane, color, use_texture=False):

    # ... (Rest of the function remains unchanged) ...


# xy plane - 0, 191, 255 (Deep Sky Blue)

create_circle_on_plane("XY", (0/255, 191/255, 255/255, 1.0))


# yz plane - (255, 105, 180)

create_circle_on_plane("YZ", (255/255, 105/255, 180/255, 1.0))


# zx plane - 薄緑 (Light Green) - (144, 238, 144)

create_circle_on_plane("ZX", (144/255, 238/255, 144/255, 1.0))


# Assign image texture to the specified plane (XY) and leave the others with their original color

image_path = r"C:\aaa 2023 dondon\aaa2023いつもの\blende_gazou\test 貼り付け 2023\2023-08-03_09h12_22.png"  # Replace with the path to your image

image_texture = bpy.data.images.load(image_path)


for plane in ["XY", "YZ", "ZX"]:

    material_name = "Circle_Material_" + plane

    material = bpy.data.materials[material_name]

    material.use_nodes = True

    bsdf_node = material.node_tree.nodes.get('Principled BSDF')


    if plane == "XY":

        texture_node = material.node_tree.nodes.new(type='ShaderNodeTexImage')

        texture_node.image = image_texture

        material.node_tree.links.new(bsdf_node.inputs['Base Color'], texture_node.outputs['Color'])

    else:

        # Reset the color for other circles to their original color

        material.diffuse_color = bpy.context.scene.cursor.color