Hi everyone.
I’m a noob in python, i just started learing it, and i’m trying a simple script.
I want to add a decimator modifier to a selected mesh
So i wrote in the script windows
import bpy
bpy.ops.object.modifier_add(type='DECIMATE')
and running it blender add the modifier to the selected mesh.
The problem starts when i try to set the decimate ratio
Following the manual
http://www.blender.org/documentation/250PythonDoc/bpy.types.DecimateModifier.html#bpy.types.DecimateModifier
I tryed
bpy.types.DecimateModifier.ratio(type='0.5')
but it gave
AttributeError: type object 'DecimateModifier' has no attribute 'ratio'
So i tryed
bpy.types.DecimateModifier(ratio='0.5')
and it gave
TypeError: bpy_struct.__new__() takes exactly 1 argument (0 given)
Another error came out when i tryed
bpy.types.realtime('DecimateModifier')
to show the modifier applied in the game engine
AttributeError: 'RNA_Types' object has no attribute 'realtime'
Here the documentation
Can anyone say me what i’m doing wrong?
thanks a lot!! :eyebrowlift: