System Information
Windows 10 x64
GTX 950M
Blender Version
Broken:
Date: 2019-01-18
Hash: c59370bf643f
Looks like the decimate modifier doesn't work when used in operator settings. Every other modifier seems to work fine.
Exact steps for others to reproduce the error
1: Select a mesh object
2: Run script, run operator, and enable Decimate.
3: Increase Subsurf Amount and watch it change.
4: Adjust Decimate Amount (Nothing happens other than number changing on modifier).
5: Adjust Iterations under modifier settings and watch it work like it should.
import bpy def main(context, strip_surf_amount, strip_decimate_amount): ACT_OBJ = bpy.context.active_object #Subsurf Modifier SUB_MOD = ACT_OBJ.modifiers.new(name="Subsurf_Strips", type='SUBSURF') SUB_MOD.levels = strip_surf_amount SUB_MOD.subdivision_type = 'CATMULL_CLARK' bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Subsurf_Strips") #Decimate Modifier DECIMATE_MOD = ACT_OBJ.modifiers.new(name="Decimate_Strips", type='DECIMATE') DECIMATE_MOD.decimate_type = 'UNSUBDIV' DECIMATE_MOD.iterations = strip_decimate_amount #smooth modifier SMOOTH_MOD_1 = ACT_OBJ.modifiers.new("Smooth_Strips_1", 'SMOOTH') SMOOTH_MOD_1.use_x = True SMOOTH_MOD_1.use_y = True SMOOTH_MOD_1.use_z = True SMOOTH_MOD_1.factor = 0.5 SMOOTH_MOD_1.iterations = 2 #4 class SimpleOperator(bpy.types.Operator): """Tooltip""" bl_idname = "object.simple_operator" bl_label = "Simple Object Operator" bl_options = {'REGISTER', 'UNDO'} strip_surf_amount: bpy.props.IntProperty( name="Subsurf Amount", description="Amount of subsurf", default=1, ) strip_decimate: bpy.props.BoolProperty( name="Decimate", description="Decimate", default=False, ) strip_decimate_amount: bpy.props.IntProperty( name="Decimate Amount", description="Amount to decimate", default=2, ) def draw(self, context): layout = self.layout #Topology box = layout.box() col = box.column(align=True) col.label(text="Topology") col.prop(self, "strip_surf_amount", text="Subsurf Amount") col.prop(self, "strip_decimate", text="Decimate") if self.strip_decimate: col.prop(self, "strip_decimate_amount", text="Decimate Amount") def execute(self, context): main(context, self.strip_surf_amount, self.strip_decimate_amount) return {'FINISHED'} def register(): bpy.utils.register_class(SimpleOperator) def unregister(): bpy.utils.unregister_class(SimpleOperator) if __name__ == "__main__": register()