0
$\begingroup$

In one discussion, they provide a way to creat textures in blender Creating a new particle texture using python scripting

I listed the key part here

mat = bpy.data.materials['Material']
tex = bpy.data.textures.new("SomeName", 'IMAGE')
slot = mat.texture_slots.add()
slot.texture = tex

However, when I ran the command

 tex = bpy.data.textures.new("SomeName", 'IMAGE')

What I get is error

TypeError: Calling operator "bpy.ops.texture.new" error, expected a string enum in ('INVOKE_DEFAULT', 'INVOKE_REGION_WIN', 'INVOKE_REGION_CHANNELS', 'INVOKE_REGION_PREVIEW', 'INVOKE_AREA', 'INVOKE_SCREEN', 'EXEC_DEFAULT', 'EXEC_REGION_WIN', 'EXEC_REGION_CHANNELS', 'EXEC_REGION_PREVIEW', 'EXEC_AREA', 'EXEC_SCREEN')

It seems that there are multiple overloaded versions of function bpy.data.textures.new() and bpy.data.textures.new(...)

How can we use them correctly?

$\endgroup$
  • 3
    $\begingroup$ The error message is from incorrectly calling the operator bpy.ops.texture.new() not the API method bpy.data.textures.new(). $\endgroup$ – batFINGER May 15 '18 at 7:13
0
$\begingroup$

You have to select manually or by script object on which this texture will be applied. If the model is selected it should be highlighted or press 'R' the model should be able to rotate.

| improve this answer | |
$\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.