Created
June 18, 2021 15:03
-
-
Save kuguma/f37a7aa541c08f9bd515a0f3ddf507d7 to your computer and use it in GitHub Desktop.
modifier_sync.py
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
""" | |
同じデータを持つオブジェクト同士でのModifier設定を同期します。 | |
設定元となるオブジェクトを選択してスクリプトを実行してください。 | |
他のオブジェクトはそのModifierの設定で上書きされます。 | |
""" | |
import bpy | |
print("<script start>") | |
target_obj = bpy.context.view_layer.objects.active | |
print(f'target obj : {target_obj.name}') | |
target_data_name = target_obj.data.name | |
print(f'target data : {target_data_name}') | |
bpy.ops.object.select_all(action='DESELECT') | |
# Select all objects that are linked to the same data as the active object | |
for obj in bpy.data.objects: | |
if obj.type == "MESH" and obj.data.name == target_data_name: | |
obj.select_set(True) | |
print(f'select obj : {obj.name}') | |
# And activate target object | |
target_obj.select_set(True) | |
# Applies the active object's MODIFIER to all other selected objects | |
bpy.ops.object.make_links_data(type='MODIFIERS') | |
print("done") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment