Skip to main content
Became Hot Network Question
deleted 5 characters in body
Source Link
J. SungHoon
  • 2.3k
  • 13
  • 41

I'm going to write a script that adds Surface DevelopmentDeform Modifier to multiple objects in batches and binds it to the target object.

I succeeded in adding a Modifier to all selected objects and setting a target object, but failed to bind. Currently, my script runs Bind operation only for the active object.

How can I fix my script?

import bpy

obs             = bpy.context.selected_objects
modifier_type   = 'SURFACE_DEFORM'
modifier_target = bpy.data.objects['Plane']

for ob in obs :
    ob.modifiers.new(name=modifier_type,type=modifier_type)
    ob.modifiers[modifier_type].target=modifier_target
    bpy.ops.object.surfacedeform_bind(modifier=modifier_type)

I'm going to write a script that adds Surface Development Modifier to multiple objects in batches and binds it to the target object.

I succeeded in adding a Modifier to all selected objects and setting a target object, but failed to bind. Currently, my script runs Bind operation only for the active object.

How can I fix my script?

import bpy

obs             = bpy.context.selected_objects
modifier_type   = 'SURFACE_DEFORM'
modifier_target = bpy.data.objects['Plane']

for ob in obs :
    ob.modifiers.new(name=modifier_type,type=modifier_type)
    ob.modifiers[modifier_type].target=modifier_target
    bpy.ops.object.surfacedeform_bind(modifier=modifier_type)

I'm going to write a script that adds Surface Deform Modifier to multiple objects in batches and binds it to the target object.

I succeeded in adding a Modifier to all selected objects and setting a target object, but failed to bind. Currently, my script runs Bind operation only for the active object.

How can I fix my script?

import bpy

obs             = bpy.context.selected_objects
modifier_type   = 'SURFACE_DEFORM'
modifier_target = bpy.data.objects['Plane']

for ob in obs :
    ob.modifiers.new(name=modifier_type,type=modifier_type)
    ob.modifiers[modifier_type].target=modifier_target
    bpy.ops.object.surfacedeform_bind(modifier=modifier_type)
Source Link
J. SungHoon
  • 2.3k
  • 13
  • 41

To control the Bind of the Surface Deform Modifier with Python

I'm going to write a script that adds Surface Development Modifier to multiple objects in batches and binds it to the target object.

I succeeded in adding a Modifier to all selected objects and setting a target object, but failed to bind. Currently, my script runs Bind operation only for the active object.

How can I fix my script?

import bpy

obs             = bpy.context.selected_objects
modifier_type   = 'SURFACE_DEFORM'
modifier_target = bpy.data.objects['Plane']

for ob in obs :
    ob.modifiers.new(name=modifier_type,type=modifier_type)
    ob.modifiers[modifier_type].target=modifier_target
    bpy.ops.object.surfacedeform_bind(modifier=modifier_type)