Page MenuHome

RuntimeError: bpy.ops.object.gpencil_modifier_apply()
Closed, ResolvedPublic

Description

System Information
Operating system: Windows 7
Graphics card: NVidia

Blender Version
Broken:
(example: blender-2.80.0-git.0661bcba3210-windows64)

I'm trying to use the Thickness modifier from the console or class, I get the error

bpy.ops.object.gpencil_modifier_apply(apply_as='DATA', modifier="Thickness")

Traceback (most recent call last):

File "<blender_console>", line 1, in <module>{F6094887}
File "G:\SOFT\Blender\Сборка\blender-2.80-0661bcba3210-win64\blender-2.80.0-git.0661bcba3210-windows64\2.80\scripts\modules\bpy\ops.py", line 200, in __call__
  ret = op_call(self.idname_py(), None, kw)

RuntimeError: Operator bpy.ops.object.gpencil_modifier_apply.poll() Context missing 'modifier'

Event Timeline

I can reproduce it in Win 10, a4e4d9f0ab89

Steps:

  1. Open Blender
  2. Load Factory Settings
  3. Open Text Editor -> New
  4. Paste the following code
  5. Run Script (Alt P)
  6. RuntimeError
import bpy
bpy.ops.object.gpencil_add(view_align=False, location=(0, 0, 0), type='STROKE')
bpy.ops.object.gpencil_modifier_add(type='GP_THICK')

# bpy.ops.object.gpencil_modifier_remove(modifier="Thickness") # also doesn't work
bpy.ops.object.gpencil_modifier_apply(apply_as='DATA', modifier="Thickness")
Sebastian Parborg (zeddb) triaged this task as Confirmed, Medium priority.Jan 25 2019, 6:31 PM

@Brecht Van Lommel (brecht) Could you take a look on this? I don't know why is not working. @Dalai Felinto (dfelinto) duplicated the object modifier to grease pencil modifiers basics and after that I added all the modifiers.