Post #2477: I’m trying to expose some parts of some modifiers and Blender interface that are

📋 Metadata

🏷️ Tags

custom-code python-scripting intermediate unsolved

  • Python Scripting
  • Property Editor
  • Popup Dialog Editor

💬 Content

I’m trying to expose some parts of some modifiers and Blender interface that are inside individual panels (something more “granular” than the panels available by pressing the “interactive panels”. Is there any documentation or way I should go about find which custom code I should use?

Right now I got (from some of the responses to this thread) things like

C.object.modifiers["Decimate"].ratio

as a “Property” to have control of the percentage of Decimate, as well as

L.template_list("MATERIAL_UL_matslots", "", C.object, "material_slots", C.object, "active_material_index", rows=1)

To get only the Material list exposed, but I couldn’t get the texture’s list by using a similar code:

L.template_list("TEXTURE_UL_texslots", "", C.object, "texture_slots", C.object, "active_texture_index", rows=1)

I found the texture’s code by going to the “Edit Source” and changing some of it to match the previous, but it didn’t work. Is there any better way I could go doing it? I’ve got a lot of individual parts I need to expose and I’d rather not flood this thread with my questions, hahaha.

While I’m at it, do you know if there’s any way for me to save an texture image I baked from the 3D View? I tried to following code but it didn’t work (probably due to the context).

bpy.ops.image.save_as(save_as_render=False, filepath="//texture.png", relative_path=True, show_multiview=False, use_multiview=False)

🔗 View on Blender Artists