AnswerBun.com

2.90 "keyword "apply_as" unrecognized" - Error

Blender Asked by Increality on January 2, 2022

Using 2.90.0 Beta, I get a
TypeError: Converting py args to operator properties: : keyword "apply_as" unrecognized

I believe this is coming from a Boolean modifier:

    context = bpy.context
    scene = context.scene
    tX = scene.objects.get("tX")
    tCut = scene.objects.get("tCut")
    if tX and tCut:
        bool = tX.modifiers.new(name='bool', type='BOOLEAN')
        bool.object = tCut
        bool.operation = 'DIFFERENCE'
        bpy.ops.object.modifier_apply(
                {"object": tX},
                apply_as='DATA',
                modifier=bool.name)

What’s interesting is it’s mentioning two other python files:

Error: Traceback (most recent call last):
  File "C:Users"user"DesktopBlender2.902.90scriptsstartuppanel_sidebar.py", line 131, in execute
    modifier=bool.name)
  File "C:Users"user"DesktopBlender2.902.90scriptsmodulesbpyops.py", line 199, in __call__
    ret = op_call(self.idname_py(), C_dict, kw, C_exec, C_undo)
TypeError: Converting py args to operator properties: : keyword "apply_as" unrecognized

location: <unknown location>:-1

The panel_sidebar.py also contains the boolean function, but it wasn’t being utilized. It throws a different error when it is utilized:

Error: Traceback (most recent call last):
  File "panel_sidebar.py", line 125, in execute
    bool = tX.modifiers.new(name='bool', type='BOOLEAN')
AttributeError: type object 'tX' has no attribute 'modifiers'

The ops.py has never been touched. All of this has been working fine in 2.82 & 2.83. Thank you

One Answer

This is not specific to boolean modifier. There was changes to python for modifiers. Remove the apply_as='DATA' and it should work.

Before we did

for data

bpy.ops.object.modifier_apply(apply_as='DATA')

for shapekey

bpy.ops.object.modifier_apply(apply_as='SHAPE')

Now we do

for data

bpy.ops.object.modifier_apply()

for apply shapekey

bpy.ops.object.modifier_apply_as_shapekey(keep_modifier=False)

for save shapekey

bpy.ops.object.modifier_apply_as_shapekey(keep_modifier=True)

To use multiple versions of Blender, you can do like this.

version = bpy.app.version

if version >= (2, 91, 0):
    bpy.ops.object.modifier_apply()    
else;    
    bpy.ops.object.modifier_apply(apply_as='DATA')

Answered by AFWS on January 2, 2022

Add your own answers!

Related Questions

How can I create complex edge profiles on columns?

2  Asked on September 29, 2021 by instert_name

       

How to use displacement modifier?

0  Asked on September 29, 2021 by giuseppe-benenati

 

A polygon uses the same vertex twice error in animation nodes

2  Asked on September 29, 2021 by richard-bruno

 

Blend two actions

2  Asked on September 29, 2021 by fred-nek

   

Curve a Straight Line?

1  Asked on September 29, 2021 by richard-newman

 

Exporting Animations via blend files – Common Asset Duplication

1  Asked on September 29, 2021 by marcus-obrien

     

How to precisely set many camera positions for rendering?

3  Asked on September 29, 2021 by chewy-hooman

 

Piping cream through a piping tip

3  Asked on September 29, 2021 by solomancode

   

UDIM tiles not importing properly image texture shader

2  Asked on September 29, 2021 by drignatiuscole

   

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir