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
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
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP