Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class VIEW3D_PT_object_type_visibility(Panel):
- bl_space_type = 'VIEW_3D'
- bl_region_type = 'HEADER'
- bl_label = "View Object Types"
- bl_ui_units_x = 6
- def draw(self, context):
- layout = self.layout
- layout.use_property_split = True
- view = context.space_data
- col = layout.column()
- attr_object_types = (
- # Geometry
- "mesh",
- "curve",
- "surf",
- "meta",
- "font",
- None,
- # Other
- "armature",
- "lattice",
- "empty",
- "grease_pencil",
- "camera",
- "light",
- "light_probe",
- "speaker",
- )
- for attr in attr_object_types:
- if attr:
- attr_v = "show_object_viewport_"+attr
- attr_s = "show_object_select_"+attr
- myText = attr.title()
- icon_v = 'VISIBLE_IPO_ON' if getattr(view, attr_v) else 'VISIBLE_IPO_OFF'
- icon_s = 'RESTRICT_SELECT_OFF' if getattr(view, attr_s) else 'RESTRICT_SELECT_ON'
- row = col.row(align=True)
- row.label(text=myText)
- row.prop(view, attr_v, text="", icon=icon_v, emboss=False)
- row.prop(view, attr_s, text="", icon=icon_s, emboss=False)
- else:
- col.separator()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement