| 
									
										
										
										
											2009-11-01 15:21:20 +00:00
										 |  |  | # ##### BEGIN GPL LICENSE BLOCK ##### | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | #  This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  | #  modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  | #  as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  | #  of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2009-11-03 07:23:02 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2009-11-01 15:21:20 +00:00
										 |  |  | #  This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  | #  but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  | #  GNU General Public License for more details. | 
					
						
							| 
									
										
										
										
											2009-11-03 07:23:02 +00:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2009-11-01 15:21:20 +00:00
										 |  |  | #  You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  | #  along with this program; if not, write to the Free Software Foundation, | 
					
						
							|  |  |  | #  Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # ##### END GPL LICENSE BLOCK ##### | 
					
						
							| 
									
										
										
										
											2009-10-31 20:16:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | # <pep8 compliant> | 
					
						
							| 
									
										
										
										
											2009-05-08 21:52:57 +00:00
										 |  |  | import bpy | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  | narrowui = 180 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-05-08 21:52:57 +00:00
										 |  |  | class DataButtonsPanel(bpy.types.Panel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_space_type = 'PROPERTIES' | 
					
						
							|  |  |  |     bl_region_type = 'WINDOW' | 
					
						
							|  |  |  |     bl_context = "data" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def poll(self, context): | 
					
						
							|  |  |  |         return context.lattice | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | class DATA_PT_context_lattice(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "" | 
					
						
							|  |  |  |     bl_show_header = False | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         ob = context.object | 
					
						
							|  |  |  |         lat = context.lattice | 
					
						
							|  |  |  |         space = context.space_data | 
					
						
							| 
									
										
										
										
											2009-11-19 13:26:51 +00:00
										 |  |  |         wide_ui = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-19 13:26:51 +00:00
										 |  |  |         if wide_ui: | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  |             split = layout.split(percentage=0.65) | 
					
						
							|  |  |  |             if ob: | 
					
						
							|  |  |  |                 split.template_ID(ob, "data") | 
					
						
							|  |  |  |                 split.itemS() | 
					
						
							|  |  |  |             elif lat: | 
					
						
							|  |  |  |                 split.template_ID(space, "pin_id") | 
					
						
							|  |  |  |                 split.itemS() | 
					
						
							|  |  |  |         else: | 
					
						
							|  |  |  |             if ob: | 
					
						
							|  |  |  |                 layout.template_ID(ob, "data") | 
					
						
							|  |  |  |             elif lat: | 
					
						
							|  |  |  |                 layout.template_ID(space, "pin_id") | 
					
						
							| 
									
										
										
										
											2009-06-07 13:36:12 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-31 23:35:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:07:25 +00:00
										 |  |  | class DATA_PT_lattice(DataButtonsPanel): | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  |     bl_label = "Lattice" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def draw(self, context): | 
					
						
							|  |  |  |         layout = self.layout | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         lat = context.lattice | 
					
						
							| 
									
										
										
										
											2009-11-19 13:26:51 +00:00
										 |  |  |         wide_ui = context.region.width > narrowui | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(lat, "points_u") | 
					
						
							| 
									
										
										
										
											2009-11-19 13:26:51 +00:00
										 |  |  |         if wide_ui: | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  |             col = split.column() | 
					
						
							|  |  |  |         col.itemR(lat, "interpolation_type_u", text="") | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(lat, "points_v") | 
					
						
							| 
									
										
										
										
											2009-11-19 13:26:51 +00:00
										 |  |  |         if wide_ui: | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  |             col = split.column() | 
					
						
							|  |  |  |         col.itemR(lat, "interpolation_type_v", text="") | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         split = layout.split() | 
					
						
							|  |  |  |         col = split.column() | 
					
						
							|  |  |  |         col.itemR(lat, "points_w") | 
					
						
							| 
									
										
										
										
											2009-11-19 13:26:51 +00:00
										 |  |  |         if wide_ui: | 
					
						
							| 
									
										
										
										
											2009-11-14 23:24:15 +00:00
										 |  |  |             col = split.column() | 
					
						
							|  |  |  |         col.itemR(lat, "interpolation_type_w", text="") | 
					
						
							| 
									
										
										
										
											2009-10-31 19:31:45 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-20 20:40:29 +00:00
										 |  |  |         layout.itemR(lat, "outside") | 
					
						
							| 
									
										
										
										
											2009-05-08 21:52:57 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 09:42:34 +00:00
										 |  |  | bpy.types.register(DATA_PT_context_lattice) | 
					
						
							| 
									
										
										
										
											2009-06-18 14:20:25 +00:00
										 |  |  | bpy.types.register(DATA_PT_lattice) |