1
$\begingroup$

As part of a larger script, I am using the following to add a displacement modifier to each object:

displace_modifier = obj.modifiers.new(name="Displace.01", type='DISPLACE')
displace_modifier.strength = 10.0
tex = bpy.ops.texture.new("Displace.01", 'CLOUDS')
displace_modifier.texture = tex

and getting the following errors:

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\make_stone_wall.py", line 267, in execute
    main(self, context)
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\make_stone_wall.py", line 131, in main
    tex = bpy.ops.texture.new("Displace.01", 'CLOUDS')
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\modules\bpy\ops.py", line 186, in __call__
    C_dict, C_exec, C_undo = BPyOpsSubModOp._parse_args(args)
  File "C:\Program Files\Blender Foundation\Blender\2.78\scripts\modules\bpy\ops.py", line 143, in _parse_args
    raise ValueError("1-3 args execution context is supported")
ValueError: 1-3 args execution context is supported

location: <unknown location>:-1

location: <unknown location>:-1

I am pretty sure I am missing some of the arguments for bpy.ops.texture.new(...), but I haven't been able to find anything online to help me figure it out.

Does anyone know what I'm missing, here?

$\endgroup$
1
$\begingroup$

Rookie mistake. I was calling bpy.ops.texture... instead of bpy.data.texture...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.