* Split the buttons_data.py into separate files, this makes it easier to maintain them. Notes: Added an extra modifier file, because modifiers are for different object types. * Added basic lamp buttons and Sun/Sky settings. As the camera buttons they only work for the default light object for now. * Some minor code cleanup
		
			
				
	
	
		
			62 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
 | 
						|
import bpy
 | 
						|
 | 
						|
class DataButtonsPanel(bpy.types.Panel):
 | 
						|
	__space_type__ = "BUTTONS_WINDOW"
 | 
						|
	__region_type__ = "WINDOW"
 | 
						|
	__context__ = "data"
 | 
						|
 | 
						|
	def poll(self, context):
 | 
						|
		ob = context.active_object
 | 
						|
		return (ob and ob.type in ('MESH', 'CURVE', 'SURFACE', 'TEXT', 'LATTICE'))
 | 
						|
		
 | 
						|
class DATA_PT_modifiers(DataButtonsPanel):
 | 
						|
	__idname__ = "DATA_PT_modifiers"
 | 
						|
	__label__ = "Modifiers"
 | 
						|
 | 
						|
	def draw(self, context):
 | 
						|
		ob = context.active_object
 | 
						|
		layout = self.layout
 | 
						|
 | 
						|
		if not ob:
 | 
						|
			return
 | 
						|
 | 
						|
		layout.row()
 | 
						|
		layout.item_menu_enumO("OBJECT_OT_modifier_add", "type")
 | 
						|
 | 
						|
		for md in ob.modifiers:
 | 
						|
			sub = layout.box()
 | 
						|
 | 
						|
			sub.row()
 | 
						|
			sub.itemR(md, "expanded", text="")
 | 
						|
			sub.itemR(md, "name", text="")
 | 
						|
 | 
						|
			sub.itemR(md, "render", text="")
 | 
						|
			sub.itemR(md, "realtime", text="")
 | 
						|
			sub.itemR(md, "editmode", text="")
 | 
						|
			sub.itemR(md, "on_cage", text="")
 | 
						|
 | 
						|
			if (md.expanded):
 | 
						|
				sub.row()
 | 
						|
				sub.itemS()
 | 
						|
 | 
						|
				if (md.type == 'ARMATURE'):
 | 
						|
					self.armature(sub, md)
 | 
						|
 | 
						|
	def armature(self, layout, md):
 | 
						|
		layout.column()
 | 
						|
		layout.itemR(md, "object")
 | 
						|
		layout.row()
 | 
						|
		layout.itemR(md, "vertex_group")
 | 
						|
		layout.itemR(md, "invert")
 | 
						|
		layout.column_flow()
 | 
						|
		layout.itemR(md, "use_vertex_groups")
 | 
						|
		layout.itemR(md, "use_bone_envelopes")
 | 
						|
		layout.itemR(md, "quaternion")
 | 
						|
		layout.itemR(md, "b_bone_rest")
 | 
						|
		layout.itemR(md, "multi_modifier")
 | 
						|
		
 | 
						|
bpy.types.register(DATA_PT_modifiers)
 | 
						|
 | 
						|
 |