Post #646: Ho

📋 Metadata

🏷️ Tags

popup-dialog python-scripting intermediate solved

  • Custom tab scripting
  • Property Editor
  • Python API integration
  • Grease Pencil support

💬 Content

HokusPokus:

There are a few more settings in that dialog that changes when changing brushes… like Autosmooth, accumulate e.t.c… i tried to see if it was so simple to use the code you provided and change only what differed… But i guess life shouldn’t be that simple…

This code should work (Custom tab):
Auto Smooth:

L.prop(paint_settings(C).brush, "auto_smooth_factor")

Accumulate:

L.prop(paint_settings(C).brush, "use_accumulate")

Button’s id can be found in tooltiips.

HokusPokus:

Is it even possible to read up on the Blender API in this case? I get the feeling all this code is specially tailored for PME. The more i poke with this tool - the more idea’s i get

Blender API. But I recommend to start learning API with these video tutorials (video1, video2).

Also PME has some useful functions. You can find them here.

rhyging5:

This time I’m looking for the data path of current greasel pencil layer. I would like to control grease pencil properties like xray, colors, opacity etc whatever be the current gpencil layer. I have tried some lines with no succes :frowning:

The code for the current GP layer is __C.gpencil_data.layers.active
__You can use it in Custom tab. For example for opacity:

L.prop(C.gpencil_data.layers.active, "opacity")

🔗 View on Blender Artists