0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Blenderで重複して読み込んだマテリアルを共通のものに

Posted at

Blenderで アペンドやインポートで名前が重複したマテリアルのついたオブジェクトを読み込むと
「.001」といった具合に名前がかぶらないようにリネームされてマテリアルが作成されるものの
重複元のマテリアルを使用したい場合に 割り当てを変更するスクリプト

import bpy
object = bpy.context.active_object
material_slots = object.material_slots
for slot in material_slots:
    mat_name = slot.material.name
    if mat_name[-4:] == ".001":
        slot.material = bpy.data.materials[mat_name[:-4]]

とりあえず動けばいい程度の書き捨て

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?