From 6c38d4b2c982add5954b49f8f0fdcdc2abf50473 Mon Sep 17 00:00:00 2001 From: Michael Davies Date: Tue, 21 Jun 2016 14:56:20 +1000 Subject: [PATCH] Fixed bevel modifier script error when Blender non-English language is used and Translate New Data is enabled Instead of creating a modifier then looking it up in the modifiers array by name to set properties, now we new the modifier directly on the object and use the return value to set desired properties instead. --- spaceship_generator.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spaceship_generator.py b/spaceship_generator.py index 03c8f32..e64a595 100644 --- a/spaceship_generator.py +++ b/spaceship_generator.py @@ -702,12 +702,12 @@ def generate_spaceship(random_seed='', # Add a fairly broad bevel modifier to angularize shape if apply_bevel_modifier: - bpy.ops.object.modifier_add(type='BEVEL') - ob.modifiers["Bevel"].width = uniform(5, 20) - ob.modifiers["Bevel"].offset_type = 'PERCENT' - ob.modifiers["Bevel"].segments = 2 - ob.modifiers["Bevel"].profile = 0.25 - ob.modifiers["Bevel"].limit_method = 'NONE' + bevel_modifier = ob.modifiers.new('Bevel', 'BEVEL') + bevel_modifier.width = uniform(5, 20) + bevel_modifier.offset_type = 'PERCENT' + bevel_modifier.segments = 2 + bevel_modifier.profile = 0.25 + bevel_modifier.limit_method = 'NONE' # Add materials to the spaceship me = ob.data