📋 Metadata
- Author: roaoao
- Date: 2016-12-24 08:57:24
- Type:
answer - Reply to: post_00487
💬 Content
draguu:
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 = Truehow
Sometimes it’s easier to read/use “and/or” instead of “if/else”, especially in single line code. But you can use both:
DO_THIS if THIS else DO_THAT
THIS and DO_THIS or DO_THAT
setattr(ao, "xray", True) if ao.wire == True else None
or
ao.wire == True and setattr(ao, "xray", True)
❤️ 1 likes