Post #487: ![](https://blenderartists.org/user_avatar/blenderartists.org/roaoao/48/37600_2.

📋 Metadata

🏷️ Tags

beginner macro conditional-logic unsolved

  • Macro Editor
  • Python Scripting
  • Custom Panels
  • Conditional Drawing

💬 Content

roaoao:

You can split that panel into 2 panels (main and sub-panel). And draw sub-panel in the main panel only when the object has materials (Custom tab):

your_condition_here and draw_menu("sub-panel")

for example "object has materials" condition:
ao = C.active_object; ao and len(ao.material_slots) and ao.material_slots[ao.active_material_index].material and draw_menu("sub-panel")

Here is a json: [ATTACH]465135[/ATTACH]

wow that was awesome , man , but i dont understand how it works … i mean

like in this case

ao = active object ,
but i see you have not added if statement anywhere ? only “and” and then draw_menu? what is that … i mean how to do that if this then that thing ???

suppose i want to turn on Xray of an object if wireframe is turned on then ,

if ao.wire == True:
ao.xray = True

how


🔗 View on Blender Artists