2011-02-23 10:52:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/*
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +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 . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  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 . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  You  should  have  received  a  copy  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  along  with  this  program ;  if  not ,  write  to  the  Free  Software  Foundation , 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 13:34:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  Inc . ,  51  Franklin  Street ,  Fifth  Floor ,  Boston ,  MA  02110 - 1301 ,  USA . 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  Contributor ( s ) :  Blender  Foundation  2009. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 20:29:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/** \file blender/editors/interface/interface_templates.c
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *   \ ingroup  edinterface 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  <stdlib.h> 
  
						 
					
						
							
								
									
										
										
										
											2009-12-29 15:40:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <stddef.h> 
  
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  <string.h> 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "MEM_guardedalloc.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-07-01 03:35:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_anim_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_dynamicpaint_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-07-07 11:01:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_key_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_scene_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-03-16 17:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_userdef_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-24 17:22:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_utildefines.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-10-20 13:50:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_string.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-08-11 06:06:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_ghash.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-09 14:13:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLF_translation.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-19 14:07:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_animsys.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_colortools.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_context.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_dynamicpaint.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_global.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BKE_library.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_main.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-12-04 13:00:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_object.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_material.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-04-28 09:29:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_texture.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-07-14 14:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_report.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-01-14 16:57:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_displist.h" 
  
						 
					
						
							
								
									
										
										
										
											2012-01-06 01:07:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_scene.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_screen.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "ED_object.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
  also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
  making a single physics_ops.c for operators and keymaps. Also move all
  particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
  specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
  which will go back to a callback in editors. Eventually these should
  be in the depsgraph itself, but for now this gives a unified call for
  doing updates.
* GLSL materials are now refreshed on changes. There's still various
  cases missing, 
* Preview icons now hook into this system, solving various update cases
  that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
  problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
  is now used instead of glDrawPixels. This avoids problems with icons get
  clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
  and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
  with the default setup. The glDrawPixels implementation on Mac seems to
  have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
  you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
  be used with threads reliably.
											 
										 
										
											2009-09-29 19:12:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "ED_render.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "RNA_access.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-07-01 03:35:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "RNA_enum_types.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "WM_api.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "WM_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "UI_interface.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-25 15:41:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "interface_intern.h" 
  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLF_api.h" 
  
						 
					
						
							
								
									
										
										
										
											2011-09-20 07:39:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLF_translation.h" 
  
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-13 14:16:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  UI_template_fix_linking ( void )  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************** Header Template *************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-18 12:56:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateHeader ( uiLayout  * layout ,  bContext  * C ,  int  menus )  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 10:45:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutAbsoluteBlock ( layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-18 12:56:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( menus )  ED_area_header_standardbuttons ( C ,  block ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  ED_area_header_switchbutton ( C ,  block ,  0 ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************** Search Callbacks *************************/  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								typedef  struct  TemplateID  {  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ListBase  * idlb ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  prv_rows ,  prv_cols ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-17 16:06:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  preview ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  TemplateID ;  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Search browse menu, assign  */  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  id_search_call_cb ( bContext  * C ,  void  * arg_template ,  void  * item )  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TemplateID  * template =  ( TemplateID * ) arg_template ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* ID */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PointerRNA  idptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_id_pointer_create ( item ,  & idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_property_pointer_set ( & template - > ptr ,  template - > prop ,  idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_property_update ( C ,  & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ID Search browse menu, do the search */  
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  id_search_cb ( const  bContext  * C ,  void  * arg_template ,  const  char  * str ,  uiSearchItems  * items )  
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TemplateID  * template =  ( TemplateID * ) arg_template ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ListBase  * lb =  template - > idlb ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 08:27:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * id ,  * id_from =  template - > ptr . id . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  iconid ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 08:27:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  flag =  RNA_property_flag ( template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* ID listbase */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for ( id =  lb - > first ;  id ;  id =  id - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 08:27:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! ( ( flag  &  PROP_ID_SELF_CHECK )  & &  id  = =  id_from ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-14 14:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* use filter */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-03 06:51:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( RNA_property_type ( template - > prop ) = = PROP_POINTER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												RNA_id_pointer_create ( id ,  & ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( RNA_property_pointer_poll ( & template - > ptr ,  template - > prop ,  & ptr ) = = 0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-03 08:12:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-03 06:51:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-14 14:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* hide dot-datablocks, but only if filter does not force it visible */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-04 12:18:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( U . uiflag  &  USER_HIDE_DOT ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ( id - > name [ 2 ] = = ' . ' )  & &  ( str [ 0 ]  ! =  ' . ' ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-16 17:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 08:27:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( BLI_strcasestr ( id - > name + 2 ,  str ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 08:51:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												char  name_ui [ MAX_ID_NAME ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-31 01:06:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												name_uiprefix_id ( name_ui ,  id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-17 16:06:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												iconid =  ui_id_icon_get ( ( bContext * ) C ,  id ,  template - > preview ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-14 14:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-31 01:06:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( ! uiSearchItemAdd ( items ,  name_ui ,  id ,  iconid ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 08:27:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* ID Search browse menu, open */  
						 
					
						
							
								
									
										
										
										
											2009-11-11 09:59:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  uiBlock  * id_search_menu ( bContext  * C ,  ARegion  * ar ,  void  * arg_litem )  
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  char  search [ 256 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  TemplateID  template ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-29 11:29:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PointerRNA  idptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									wmWindow  * win =  CTX_wm_window ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* clear initial search string, then all items show */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									search [ 0 ] =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* arg_litem is malloced, can be freed by parent button */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									template =  * ( ( TemplateID * ) arg_litem ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-29 11:29:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* get active id for showing first item */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									idptr =  RNA_property_pointer_get ( & template . ptr ,  template . prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiBeginBlock ( C ,  ar ,  " _popup " ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetFlag ( block ,  UI_BLOCK_LOOP | UI_BLOCK_REDRAW | UI_BLOCK_RET_1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* preview thumbnails */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( template . prv_rows  >  0  & &  template . prv_cols  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  w  =  96  *  template . prv_cols ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  h  =  96  *  template . prv_rows  +  20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* fake button, it holds space for search items */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefBut ( block ,  LABEL ,  0 ,  " " ,  10 ,  15 ,  w ,  h ,  NULL ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-01-12 13:16:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but =  uiDefSearchBut ( block ,  search ,  0 ,  ICON_VIEWZOOM ,  sizeof ( search ) ,  10 ,  0 ,  w ,  19 ,  template . prv_rows ,  template . prv_cols ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiButSetSearchFunc ( but ,  id_search_cb ,  & template ,  id_search_call_cb ,  idptr . data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* list view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* fake button, it holds space for search items */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefBut ( block ,  LABEL ,  0 ,  " " ,  10 ,  15 ,  150 ,  uiSearchBoxhHeight ( ) ,  NULL ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2012-01-12 13:16:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but =  uiDefSearchBut ( block ,  search ,  0 ,  ICON_VIEWZOOM ,  sizeof ( search ) ,  10 ,  0 ,  150 ,  19 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiButSetSearchFunc ( but ,  id_search_cb ,  & template ,  id_search_call_cb ,  idptr . data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBoundsBlock ( block ,  6 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetDirection ( block ,  UI_DOWN ) ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiEndBlock ( C ,  block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-02-15 01:24:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* give search-field focus */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetFocusOnEnter ( win ,  but ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-18 16:09:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* this type of search menu requires undo */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but - > flag  | =  UI_BUT_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/************************ ID Template ***************************/  
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* This is for browsing and editing the ID-blocks used */  
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* for new/open operators */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiIDContextProperty ( bContext  * C ,  PointerRNA  * ptr ,  PropertyRNA  * * prop )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TemplateID  * template ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ARegion  * ar =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									memset ( ptr ,  0 ,  sizeof ( * ptr ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									* prop =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! ar ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( block = ar - > uiblocks . first ;  block ;  block = block - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for ( but = block - > buttons . first ;  but ;  but =  but - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* find the button before the active one */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( ( but - > flag  &  ( UI_BUT_LAST_ACTIVE | UI_ACTIVE ) ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( but - > func_argN )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													template =  but - > func_argN ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													* ptr =  template - > ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													* prop =  template - > prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  template_id_cb ( bContext  * C ,  void  * arg_litem ,  void  * arg_event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									TemplateID  * template =  ( TemplateID * ) arg_litem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  idptr =  RNA_property_pointer_get ( & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-29 04:34:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * id =  idptr . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  event =  GET_INT_FROM_POINTER ( arg_event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  UI_ID_BROWSE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  UI_ID_PIN : 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RNA_warning ( " warning, id event %d shouldnt come here " ,  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  UI_ID_OPEN : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  UI_ID_ADD_NEW : 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* these call uiIDContextPropertySet */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  UI_ID_DELETE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											memset ( & idptr ,  0 ,  sizeof ( idptr ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_property_pointer_set ( & template - > ptr ,  template - > prop ,  idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_property_update ( C ,  & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-23 15:34:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( id  & &  CTX_wm_window ( C ) - > eventstate - > shift )  /* useful hidden functionality, */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												id - > us =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  UI_ID_FAKE_USER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-17 14:20:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( id - > flag  &  LIB_FAKEUSER )  id_us_plus ( id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  id_us_min ( id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  UI_ID_LOCAL : 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( id_make_local ( id ,  0 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* reassign to get get proper updates/notifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													idptr =  RNA_property_pointer_get ( & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													RNA_property_pointer_set ( & template - > ptr ,  template - > prop ,  idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													RNA_property_update ( C ,  & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  UI_ID_ALONE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												const  int  do_scene_obj =  ( GS ( id - > name )  = =  ID_OB )  & & 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 09:01:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												                        ( template - > ptr . type  = =  & RNA_SceneObjects ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* make copy */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( do_scene_obj )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													Scene  * scene =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													ED_object_single_user ( scene ,  ( struct  Object  * ) id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													WM_event_add_notifier ( C ,  NC_SCENE | ND_OB_ACTIVE ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-11 05:04:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if ( id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														id_single_user ( C ,  id ,  & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-08 08:22:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#if 0 
  
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  UI_ID_AUTO_NAME : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-24 10:15:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  const  char  * template_id_browse_tip ( StructRNA  * type )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										switch ( RNA_type_to_ID_code ( type ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  ID_SCE :  return  N_ ( " Browse Scene to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_OB :  return  N_ ( " Browse Object to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_ME :  return  N_ ( " Browse Mesh Data to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_CU :  return  N_ ( " Browse Curve Data to be linked " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-02 21:14:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  ID_MB :  return  N_ ( " Browse Metaball Data to be linked " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											case  ID_MA :  return  N_ ( " Browse Material to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_TE :  return  N_ ( " Browse Texture to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_IM :  return  N_ ( " Browse Image to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_LT :  return  N_ ( " Browse Lattice Data to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_LA :  return  N_ ( " Browse Lamp Data to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_CA :  return  N_ ( " Browse Camera Data to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_WO :  return  N_ ( " Browse World Settings to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_SCR :  return  N_ ( " Choose Screen lay-out " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_TXT :  return  N_ ( " Browse Text to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_SPK :  return  N_ ( " Browse Speaker Data to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_SO :  return  N_ ( " Browse Sound to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_AR :  return  N_ ( " Browse Armature data to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_AC :  return  N_ ( " Browse Action to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_NT :  return  N_ ( " Browse Node Tree to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_BR :  return  N_ ( " Browse Brush to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_PA :  return  N_ ( " Browse Particle System to be linked " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											case  ID_GD :  return  N_ ( " Browse Grease Pencil Data to be linked " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-24 10:15:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  N_ ( " Browse ID data to be linked " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-24 10:15:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-08 13:07:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  template_ID ( bContext  * C ,  uiLayout  * layout ,  TemplateID  * template ,  StructRNA  * type ,  short  idcode ,  int  flag ,  const  char  * newop ,  const  char  * openop ,  const  char  * unlinkop )  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									PointerRNA  idptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-28 02:34:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// ListBase *lb; // UNUSED
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * id ,  * idfrom ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  editable =  RNA_property_editable ( & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									idptr =  RNA_property_pointer_get ( & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									id =  idptr . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									idfrom =  template - > ptr . id . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-28 02:34:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// lb= template->idlb;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( idptr . type ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										type =  idptr . type ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( flag  &  UI_ID_PREVIEWS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but =  uiDefBlockButN ( block ,  id_search_menu ,  MEM_dupallocN ( template ) ,  " " ,  0 ,  0 ,  UI_UNIT_X * 6 ,  UI_UNIT_Y * 6 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												TIP_ ( template_id_browse_tip ( type ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											but - > icon =  RNA_struct_ui_icon ( type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( id )  but - > icon  =  ui_id_icon_get ( C ,  id ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_HAS_ICON | UI_ICON_PREVIEW ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib )  | |  ! editable ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-17 16:06:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										template - > preview =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( flag  &  UI_ID_BROWSE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but =  uiDefBlockButN ( block ,  id_search_menu ,  MEM_dupallocN ( template ) ,  " " ,  0 ,  0 ,  UI_UNIT_X * 1.6 ,  UI_UNIT_Y , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												TIP_ ( template_id_browse_tip ( type ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-09 19:45:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											but - > icon =  RNA_struct_ui_icon ( type ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* default dragging of icon for id browse buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetDragID ( but ,  id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_HAS_ICON | UI_ICON_LEFT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-09 19:45:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib )  | |  ! editable ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-09 19:45:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* text button with name */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-29 00:47:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										char  name [ UI_MAX_NAME_STR ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-12 11:49:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const  short  user_alert =  ( id - > us  < =  0 ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										//text_idbutton(id, name);
 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										name [ 0 ] =  ' \0 ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but =  uiDefButR ( block ,  TEX ,  0 ,  name ,  0 ,  0 ,  UI_UNIT_X * 6 ,  UI_UNIT_Y ,  & idptr ,  " name " ,  - 1 ,  0 ,  0 ,  - 1 ,  - 1 ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_RENAME ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-12 11:49:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( user_alert )  uiButSetFlag ( but ,  UI_BUT_REDALERT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( id - > lib )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( id - > flag  &  LIB_INDIRECT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-05 10:29:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_LIBRARY_DATA_INDIRECT ,  0 , 0 , UI_UNIT_X , UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													TIP_ ( " Indirect library datablock, cannot change " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-05 10:29:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_LIBRARY_DATA_DIRECT ,  0 , 0 , UI_UNIT_X , UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													TIP_ ( " Direct linked library datablock, click to make local " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( ! id_make_local ( id ,  1  /* test */ )  | |  ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_LOCAL ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( id - > us  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											char  numstr [ 32 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											BLI_snprintf ( numstr ,  sizeof ( numstr ) ,  " %d " ,  id - > us ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefBut ( block ,  BUT ,  0 ,  numstr ,  0 , 0 , UI_UNIT_X  +  ( ( id - > us  <  10 )  ?  0 : 10 ) ,  UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											              TIP_ ( " Display number of users of this data (click to make a single-user copy) " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_ALONE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( ! id_copy ( id ,  NULL ,  1  /* test only */ )  | |  ( idfrom  & &  idfrom - > lib )  | |  ! editable ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-12 11:49:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( user_alert )  uiButSetFlag ( but ,  UI_BUT_REDALERT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-26 02:31:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-04-08 16:56:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( id - > lib  = =  NULL  & &  ! ( ELEM5 ( GS ( id - > name ) ,  ID_GR ,  ID_SCE ,  ID_SCR ,  ID_TXT ,  ID_OB ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-18 07:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiDefButR ( block ,  TOG ,  0 ,  " F " ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  & idptr ,  " use_fake_user " ,  - 1 ,  0 ,  0 ,  - 1 ,  - 1 ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-26 02:31:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( flag  &  UI_ID_ADD_NEW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  w =  id ? UI_UNIT_X :  ( flag  &  UI_ID_OPEN ) ?  UI_UNIT_X * 3 :  UI_UNIT_X * 6 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( newop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextButO ( block ,  BUT ,  newop ,  WM_OP_INVOKE_DEFAULT ,  ICON_ZOOMIN ,  ( id ) ?  " " :  IFACE_ ( " New " ) ,  0 ,  0 ,  w ,  UI_UNIT_Y ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_ADD_NEW ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextBut ( block ,  BUT ,  0 ,  ICON_ZOOMIN ,  ( id ) ?  " " :  IFACE_ ( " New " ) ,  0 ,  0 ,  w ,  UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_ADD_NEW ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib )  | |  ! editable ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( flag  &  UI_ID_OPEN )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  w =  id ? UI_UNIT_X :  ( flag  &  UI_ID_ADD_NEW ) ?  UI_UNIT_X * 3 :  UI_UNIT_X * 6 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( openop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextButO ( block ,  BUT ,  openop ,  WM_OP_INVOKE_DEFAULT ,  ICON_FILESEL ,  ( id ) ?  " " :  IFACE_ ( " Open " ) ,  0 ,  0 ,  w ,  UI_UNIT_Y ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_OPEN ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextBut ( block ,  BUT ,  0 ,  ICON_FILESEL ,  ( id ) ?  " " :  IFACE_ ( " Open " ) ,  0 ,  0 ,  w ,  UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_OPEN ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib )  | |  ! editable ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* delete button */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-30 12:22:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( id  & &  ( flag  &  UI_ID_DELETE )  & &  ( RNA_property_flag ( template - > prop )  &  PROP_NEVER_UNLINK ) = = 0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( unlinkop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-15 16:43:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconButO ( block ,  BUT ,  unlinkop ,  WM_OP_INVOKE_REGION_WIN ,  ICON_X ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-06 04:05:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* so we can access the template from operators, font unlinking needs this */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-05 10:29:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  NULL ,  MEM_dupallocN ( template ) ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_X ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													TIP_ ( " Unlink datablock. Shift + Click to set users to zero, data will then not be saved " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_DELETE ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-21 22:55:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( RNA_property_flag ( template - > prop )  &  PROP_NEVER_NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-01 16:13:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib )  | |  ! editable ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-08 13:07:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( idcode  = =  ID_TE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiTemplateTextureShow ( layout ,  C ,  & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  ui_template_id ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  const  char  * propname ,  const  char  * newop ,  const  char  * openop ,  const  char  * unlinkop ,  int  flag ,  int  prv_rows ,  int  prv_cols )  
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									TemplateID  * template ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									StructRNA  * type ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-08 13:07:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									short  idcode ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( ! prop  | |  RNA_property_type ( prop )  ! =  PROP_POINTER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " pointer property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									template =  MEM_callocN ( sizeof ( TemplateID ) ,  " TemplateID " ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
									template - > ptr =  * ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									template - > prop =  prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									template - > prv_rows  =  prv_rows ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									template - > prv_cols  =  prv_cols ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-14 14:11:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( newop ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flag  | =  UI_ID_ADD_NEW ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( openop ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										flag  | =  UI_ID_OPEN ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-24 10:15:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									type =  RNA_property_pointer_type ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-08 13:07:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									idcode =  RNA_type_to_ID_code ( type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									template - > idlb =  which_libbase ( CTX_data_main ( C ) ,  idcode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* create UI elements for this template
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 	-  template_ID  makes  a  copy  of  the  template  data  and  assigns  it  to  the  relevant  buttons 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( template - > idlb )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-08 13:07:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										template_ID ( C ,  layout ,  template ,  type ,  idcode ,  flag ,  newop ,  openop ,  unlinkop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( template ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateID ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  const  char  * propname ,  const  char  * newop ,  const  char  * openop ,  const  char  * unlinkop )  
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-08-04 12:18:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui_template_id ( layout ,  C ,  ptr ,  propname ,  newop ,  openop ,  unlinkop ,  UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE ,  0 ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-13 06:35:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateIDBrowse ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  const  char  * propname ,  const  char  * newop ,  const  char  * openop ,  const  char  * unlinkop )  
						 
					
						
							
								
									
										
										
										
											2010-01-13 06:35:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-08-04 12:18:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui_template_id ( layout ,  C ,  ptr ,  propname ,  newop ,  openop ,  unlinkop ,  UI_ID_BROWSE | UI_ID_RENAME ,  0 ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateIDPreview ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  const  char  * propname ,  const  char  * newop ,  const  char  * openop ,  const  char  * unlinkop ,  int  rows ,  int  cols )  
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-08-04 12:18:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui_template_id ( layout ,  C ,  ptr ,  propname ,  newop ,  openop ,  unlinkop ,  UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE | UI_ID_PREVIEWS ,  rows ,  cols ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												UI: Layout Engine
* Buttons are now created first, and after that the layout is computed.
  This means the layout engine now works at button level, and makes it
  easier to write templates. Otherwise you had to store all info and
  create the buttons later.
* Added interface_templates.c as a separate file to put templates in.
  These can contain regular buttons, and can be put in a Free layout,
  which means you can specify manual coordinates, but still get nested
  correct inside other layouts.
* API was changed to allow better nesting. Previously items were added
  in the last added layout specifier, i.e. one level up in the layout
  hierarchy. This doesn't work well in always, so now when creating things
  like rows or columns it always returns a layout which you have to add
  the items in. All py scripts were updated to follow this.
* Computing the layout now goes in two passes, first estimating the
  required width/height of all nested layouts, and then in the second
  pass using the results of that to decide on the actual locations.
* Enum and array buttons now follow the direction of the layout, i.e.
  they are vertical or horizontal depending if they are in a column or row.
* Color properties now get a color picker, and only get the additional
  RGB sliders with Expand=True.
* File/directory string properties now get a button next to them for
  opening the file browse, though this is not implemented yet.
* Layout items can now be aligned, set align=True when creating a column,
  row, etc.
* Buttons now get a minimum width of one icon (avoids squashing icon
  buttons).
* Moved some more space variables into Style.
											 
										 
										
											2009-05-15 11:19:59 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/************************ ID Chooser Template ***************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* This is for selecting the type of ID-block to use, and then from the relevant type choosing the block to use 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  propname :  property  identifier  for  property  that  ID - pointer  gets  stored  to 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 *  -  proptypename :  property  identifier  for  property  used  to  determine  the  type  of  ID - pointer  that  can  be  used 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateAnyID ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname ,  const  char  * proptypename ,  const  char  * text )  
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * propID ,  * propType ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * row ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* get properties... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									propID =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									propType =  RNA_struct_find_property ( ptr ,  proptypename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! propID  | |  RNA_property_type ( propID )  ! =  PROP_POINTER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " pointer property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! propType  | |  RNA_property_type ( propType )  ! =  PROP_ENUM )  {  
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " pointer-type property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  proptypename ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Start drawing UI Elements using standard defines */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Label - either use the provided text, or will become "ID-Block:" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( text ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( row ,  text ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( row ,  " ID-Block: " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* ID-Type Selector - just have a menu of icons */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// FIXME: the icon-only setting doesn't work when we supply a blank name
 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemFullR ( row ,  ptr ,  propType ,  0 ,  0 ,  UI_ITEM_R_ICON_ONLY ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* ID-Block Selector - just use pointer widget... */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemFullR ( row ,  ptr ,  propID ,  0 ,  0 ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************* RNA Path Builder Template ********************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 09:59:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* ---------- */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* This is creating/editing RNA-Paths 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  ptr :  struct  which  holds  the  path  property 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  propname :  property  identifier  for  property  that  path  gets  stored  to 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  -  root_ptr :  struct  that  path  gets  built  from 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplatePathBuilder ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname ,  PointerRNA  * UNUSED ( root_ptr ) ,  const  char  * text )  
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * propPath ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * row ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* check that properties are valid */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									propPath =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! propPath  | |  RNA_property_type ( propPath )  ! =  PROP_STRING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " path property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Start drawing UI Elements using standard defines */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* Path (existing string) Widget */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemR ( row ,  ptr ,  propname ,  0 ,  text ,  ICON_RNA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-15 10:13:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// TODO: attach something to this to make allow searching of nested properties to 'build' the path
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/************************ Modifier Template *************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define ERROR_LIBDATA_MESSAGE "Can't edit external libdata" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  <string.h> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_object_force.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_depsgraph.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_modifier.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_particle.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_util.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_math.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BLI_listbase.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_object.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  modifiers_setOnCage ( bContext  * C ,  void  * ob_v ,  void  * md_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * ob  =  ob_v ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 21:03:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ModifierData  * md =  md_v ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  i ,  cageIndex  =  modifiers_getCageIndex ( scene ,  ob ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 21:03:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* undo button operation */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									md - > mode  ^ =  eModifierMode_OnCage ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for ( i  =  0 ,  md = ob - > modifiers . first ;  md ;  + + i ,  md = md - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( md  = =  md_v )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( i  > =  cageIndex ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												md - > mode  ^ =  eModifierMode_OnCage ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT | ND_MODIFIER ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-05 18:59:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_id_tag_update ( & ob - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  modifiers_convertToReal ( bContext  * C ,  void  * ob_v ,  void  * md_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob  =  ob_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * md  =  md_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * nmd  =  modifier_new ( md - > type ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									modifier_copyData ( md ,  nmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									nmd - > mode  & =  ~ eModifierMode_Virtual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									BLI_addhead ( & ob - > modifiers ,  nmd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 09:48:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									modifier_unique_name ( & ob - > modifiers ,  nmd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob - > partype  =  PAROBJECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT | ND_MODIFIER ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-05 18:59:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_id_tag_update ( & ob - > id ,  OB_RECALC_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ED_undo_push ( C ,  " Modifier convert to real " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  modifier_can_delete ( ModifierData  * md )  
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-12-22 00:03:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* fluid particle modifier can't be deleted here */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( md - > type  = =  eModifierType_ParticleSystem ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ( ( ParticleSystemModifierData  * ) md ) - > psys - > part - > type  = =  PART_FLUID ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 00:03:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/* Check wheter Modifier is a simulation or not, this is used for switching to the physics/particles context tab */  
						 
					
						
							
								
									
										
										
										
											2011-04-25 13:47:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  modifier_is_simulation ( ModifierData  * md )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-12-22 00:03:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Physic Tab */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ELEM7 ( md - > type ,  eModifierType_Cloth ,  eModifierType_Collision ,  eModifierType_Fluidsim ,  eModifierType_Smoke , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									                    eModifierType_Softbody ,  eModifierType_Surface ,  eModifierType_DynamicPaint ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-25 13:47:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 00:03:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Particle Tab */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-25 13:47:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( md - > type  = =  eModifierType_ParticleSystem )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-12-22 00:03:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  uiLayout  * draw_modifier ( uiLayout  * layout ,  Scene  * scene ,  Object  * ob ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                               ModifierData  * md ,  int  index ,  int  cageIndex ,  int  lastCageIndex ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierTypeInfo  * mti  =  modifierType_getInfo ( md - > type ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * box ,  * column ,  * row ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * result =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  isVirtual  =  ( md - > mode  &  eModifierMode_Virtual ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  str [ 128 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* create RNA pointer */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_pointer_create ( & ob - > id ,  & RNA_Modifier ,  md ,  & ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									column =  uiLayoutColumn ( layout ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayoutSetContextPointer ( column ,  " modifier " ,  & ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* rounded header ------------------------------------------------------------------- */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									box =  uiLayoutBox ( column ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( isVirtual )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetAlignment ( row ,  UI_LAYOUT_ALIGN_EXPAND ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										block =  uiLayoutGetBlock ( row ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* VIRTUAL MODIFIER */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// XXX this is not used now, since these cannot be accessed via RNA
 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:53:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_snprintf ( str ,  sizeof ( str ) ,  " %s parent deform " ,  md - > name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefBut ( block ,  LABEL ,  0 ,  str ,  0 ,  0 ,  185 ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Modifier name " ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but  =  uiDefBut ( block ,  BUT ,  0 ,  IFACE_ ( " Make Real " ) ,  0 ,  0 ,  80 ,  16 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													TIP_ ( " Convert virtual modifier to a real modifier " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiButSetFunc ( but ,  modifiers_convertToReal ,  ob ,  md ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* REAL MODIFIER */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row  =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										block  =  uiLayoutGetBlock ( row ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-31 10:21:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* Open/Close .................................  */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " show_expanded " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* modifier-type icon */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( row ,  " " ,  RNA_struct_ui_icon ( ptr . type ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* modifier name */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " name " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* mode enabling buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Softbody not allowed in this situation, enforce! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  (  ( ( md - > type ! = eModifierType_Softbody  & &  md - > type ! = eModifierType_Collision )  | |  ! ( ob - > pd  & &  ob - > pd - > deflect ) )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											& &  ( md - > type ! = eModifierType_Surface )  )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemR ( row ,  & ptr ,  " show_render " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemR ( row ,  & ptr ,  " show_viewport " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mti - > flags  &  eModifierTypeFlag_SupportsEditmode ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemR ( row ,  & ptr ,  " show_in_editmode " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 16:57:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 08:12:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ob - > type = = OB_MESH )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-06 18:40:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( modifier_couldBeCage ( scene ,  md )  & &  ( index  < =  lastCageIndex ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 08:12:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* -- convert to rna ? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but  =  uiDefIconButBitI ( block ,  TOG ,  eModifierMode_OnCage ,  0 ,  ICON_MESH_DATA ,  0 ,  0 ,  UI_UNIT_X - 2 ,  UI_UNIT_Y ,  & md - > mode ,  0.0 ,  0.0 ,  0.0 ,  0.0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														TIP_ ( " Apply modifier to editing cage during Editmode " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 08:12:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( index  <  cageIndex ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiButSetFunc ( but ,  modifiers_setOnCage ,  ob ,  md ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* place holder button */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_NONE ,  0 ,  0 ,  UI_UNIT_X - 2 ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-02 16:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										}  /* tessellation point for curve-typed objects */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 08:12:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  if  ( ELEM3 ( ob - > type ,  OB_CURVE ,  OB_SURF ,  OB_FONT ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* some modifiers could work with pre-tessellated curves only */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 16:57:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ELEM3 ( md - > type ,  eModifierType_Hook ,  eModifierType_Softbody ,  eModifierType_MeshDeform ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* add disabled pre-tessellated button, so users could have
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 16:31:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												 *  message  for  this  modifiers  */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but  =  uiDefIconButBitI ( block ,  TOG ,  eModifierMode_ApplyOnSpline ,  0 ,  ICON_SURFACE_DATA ,  0 ,  0 ,  UI_UNIT_X - 2 ,  UI_UNIT_Y ,  & md - > mode ,  0.0 ,  0.0 ,  0.0 ,  0.0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														TIP_ ( " This modifier could be applied on splines' points only " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 16:57:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											}  else  if  ( mti - > type  ! =  eModifierTypeType_Constructive )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 11:45:08 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												/* constructive modifiers tessellates curve before applying */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemR ( row ,  & ptr ,  " use_apply_on_spline " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 16:57:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* Up/Down + Delete ........................... */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-31 10:21:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemO ( row ,  " " ,  ICON_TRIA_UP ,  " OBJECT_OT_modifier_move_up " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemO ( row ,  " " ,  ICON_TRIA_DOWN ,  " OBJECT_OT_modifier_move_down " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-31 10:21:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-25 13:47:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										// When Modifier is a simulation, show button to switch to context rather than the delete button. 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( modifier_can_delete ( md )  & &  ! modifier_is_simulation ( md ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemO ( row ,  " " ,  ICON_X ,  " OBJECT_OT_modifier_remove " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-04-25 13:47:15 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( modifier_is_simulation ( md )  = =  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemStringO ( row ,  " " ,  ICON_BUTS ,  " WM_OT_properties_context_change " ,  " context " ,  " PHYSICS " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  if  ( modifier_is_simulation ( md )  = =  2 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemStringO ( row ,  " " ,  ICON_BUTS ,  " WM_OT_properties_context_change " ,  " context " ,  " PARTICLES " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* modifier settings (under the header) --------------------------------------------------- */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! isVirtual  & &  ( md - > mode  &  eModifierMode_Expanded ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* apply/convert/copy */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box =  uiLayoutBox ( column ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 13:44:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! ELEM ( md - > type ,  eModifierType_Collision ,  eModifierType_Surface ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* only here obdata, the rest of modifiers is ob level */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockSetButLock ( block ,  object_data_is_libdata ( ob ) ,  ERROR_LIBDATA_MESSAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( md - > type = = eModifierType_ParticleSystem )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												ParticleSystem  * psys =  ( ( ParticleSystemModifierData  * ) md ) - > psys ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( ! ( ob - > mode  &  OB_MODE_PARTICLE_EDIT )  & &  psys - > pathcache )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-26 11:15:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if ( ELEM ( psys - > part - > ren_as ,  PART_DRAW_GR ,  PART_DRAW_OB ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														uiItemO ( row ,  " Convert " ,  ICON_NONE ,  " OBJECT_OT_duplicates_make_real " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-26 11:15:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													else  if ( psys - > part - > ren_as  = =  PART_DRAW_PATH ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														uiItemO ( row ,  " Convert " ,  ICON_NONE ,  " OBJECT_OT_modifier_convert " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 18:17:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-22 01:55:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiLayoutSetOperatorContext ( row ,  WM_OP_INVOKE_DEFAULT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemEnumO ( row ,  " OBJECT_OT_modifier_apply " ,  IFACE_ ( " Apply " ) ,  0 ,  " apply_as " ,  MODIFIER_APPLY_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 18:17:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 14:15:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( modifier_sameTopology ( md )  & &  ! modifier_nonGeometrical ( md ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-23 03:13:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uiItemEnumO ( row ,  " OBJECT_OT_modifier_apply " ,  IFACE_ ( " Apply as Shape Key " ) ,  0 ,  " apply_as " ,  MODIFIER_APPLY_SHAPE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 18:17:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockClearButLock ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockSetButLock ( block ,  ob  & &  ob - > id . lib ,  ERROR_LIBDATA_MESSAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-08-17 08:34:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( ! ELEM5 ( md - > type ,  eModifierType_Fluidsim ,  eModifierType_Softbody ,  eModifierType_ParticleSystem ,  eModifierType_Cloth ,  eModifierType_Smoke ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-20 14:15:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemO ( row ,  IFACE_ ( " Copy " ) ,  ICON_NONE ,  " OBJECT_OT_modifier_copy " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* result is the layout block inside the box, that we return so that modifier settings can be drawn */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										result =  uiLayoutColumn ( box ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 10:45:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										block =  uiLayoutAbsoluteBlock ( box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* error messages */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( md - > error )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box  =  uiLayoutBox ( column ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										row  =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( row ,  md - > error ,  ICON_ERROR ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  result ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								uiLayout  * uiTemplateModifier ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr )  
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ModifierData  * md ,  * vmd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ,  lastCageIndex ,  cageIndex ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* verify we have valid data */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! RNA_struct_is_a ( ptr - > type ,  & RNA_Modifier ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Expected modifier on object " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob =  ptr - > id . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									md =  ptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! ob  | |  ! ( GS ( ob - > id . name )  = =  ID_OB ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Expected modifier on object " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:37:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetButLock ( uiLayoutGetBlock ( layout ) ,  ( ob  & &  ob - > id . lib ) ,  ERROR_LIBDATA_MESSAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* find modifier and draw it */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cageIndex  =  modifiers_getCageIndex ( scene ,  ob ,  & lastCageIndex ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// XXX virtual modifiers are not accesible for python
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									vmd  =  modifiers_getVirtualModifierList ( ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( i = 0 ;  vmd ;  i + + ,  vmd = vmd - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( md  = =  vmd ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  draw_modifier ( layout ,  scene ,  ob ,  md ,  i ,  cageIndex ,  lastCageIndex ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  if ( vmd - > mode  &  eModifierMode_Virtual ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											i - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/************************ Constraint Template *************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "DNA_constraint_types.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_action.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_constraint.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define REDRAWIPO					1 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define REDRAWNLA					2 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define REDRAWBUTSOBJECT			3		 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define REDRAWACTION				4 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_CONSTRAINT_TEST			5 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_CONSTRAINT_CHANGETARGET	6 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define REMAKEIPO					8 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_DIFF						9 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-13 14:16:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  do_constraint_panels ( bContext  * C ,  void  * ob_pt ,  int  event )  
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Main  * bmain =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Scene  * scene =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-07 12:51:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * ob =  ( Object  * ) ob_pt ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  B_CONSTRAINT_TEST : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										break ;   // no handling
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  B_CONSTRAINT_CHANGETARGET : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > pose )  ob - > pose - > flag  | =  POSE_RECALC ; 	// checks & sorts pose channels
 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-01 12:47:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										DAG_scene_sort ( bmain ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-18 16:05:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// note: RNA updates now call this, commenting else it gets called twice.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// if there are problems because of this, then rna needs changed update functions.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// object_test_constraints(ob);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// if(ob->pose) update_pose_constraint_flags(ob->pose);
 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-12-05 18:59:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( ob - > type = = OB_ARMATURE )  DAG_id_tag_update ( & ob - > id ,  OB_RECALC_DATA | OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  DAG_id_tag_update ( & ob - > id ,  OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-24 21:22:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT | ND_CONSTRAINT ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  constraint_active_func ( bContext  * UNUSED ( C ) ,  void  * ob_v ,  void  * con_v )  
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_object_constraint_set_active ( ob_v ,  con_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* draw panel showing settings for a constraint */  
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  uiLayout  * draw_constraint ( uiLayout  * layout ,  Object  * ob ,  bConstraint  * con )  
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bPoseChannel  * pchan =  get_active_posechannel ( ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bConstraintTypeInfo  * cti ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * result =  NULL ,  * col ,  * box ,  * row ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  typestr [ 32 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									short  proxy_protected ,  xco = 0 ,  yco = 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-28 02:34:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// int rb_col; // UNUSED
 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* get constraint typeinfo */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cti =  constraint_get_typeinfo ( con ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( cti  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:53:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_strncpy ( typestr ,  ( con - > type  = =  CONSTRAINT_TYPE_NULL )  ?  " Null "  :  " Unknown " ,  sizeof ( typestr ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:53:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_strncpy ( typestr ,  cti - > name ,  sizeof ( typestr ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* determine whether constraint is proxy protected or not */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( proxylocked_constraints_owner ( ob ,  pchan ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										proxy_protected =  ( con - > flag  &  CONSTRAINT_PROXY_LOCAL ) = = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										proxy_protected =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* unless button has own callback, it adds this callback to button */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:37:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-07 12:51:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetHandleFunc ( block ,  do_constraint_panels ,  ob ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetFunc ( block ,  constraint_active_func ,  ob ,  con ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_pointer_create ( & ob - > id ,  & RNA_Constraint ,  con ,  & ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									col =  uiLayoutColumn ( layout ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayoutSetContextPointer ( col ,  " constraint " ,  & ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									box =  uiLayoutBox ( col ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									row  =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Draw constraint header */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* open/close */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemR ( row ,  & ptr ,  " show_expanded " ,  UI_ITEM_R_ICON_ONLY ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* name */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefBut ( block ,  LABEL ,  B_CONSTRAINT_TEST ,  typestr ,  xco + 10 ,  yco ,  100 ,  18 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 09:42:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 17:47:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( con - > flag  &  CONSTRAINT_DISABLE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetRedAlert ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( proxy_protected  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " name " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( row ,  con - > name ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 17:47:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayoutSetRedAlert ( row ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* proxy-protected constraints cannot be edited, so hide up/down + close buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( proxy_protected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* draw a ghost icon (for proxy) and also a lock beside it, to show that constraint is "proxy locked" */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  BUT ,  B_CONSTRAINT_TEST ,  ICON_GHOST ,  xco + 244 ,  yco ,  19 ,  19 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  TIP_ ( " Proxy Protected " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  BUT ,  B_CONSTRAINT_TEST ,  ICON_LOCKED ,  xco + 262 ,  yco ,  19 ,  19 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  TIP_ ( " Proxy Protected " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										short  prev_proxylock ,  show_upbut ,  show_downbut ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Up/Down buttons: 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	Proxy - constraints  are  not  allowed  to  occur  after  local  ( non - proxy )  constraints 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	as  that  poses  problems  when  restoring  them ,  so  disable  the  " up "  button  where 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	it  may  cause  this  situation .  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *  	Up / Down  buttons  should  only  be  shown  ( or  not  greyed  -  todo )  if  they  serve  some  purpose .  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( proxylocked_constraints_owner ( ob ,  pchan ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( con - > prev )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												prev_proxylock =  ( con - > prev - > flag  &  CONSTRAINT_PROXY_LOCAL )  ?  0  :  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												prev_proxylock =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											prev_proxylock =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										show_upbut =  ( ( prev_proxylock  = =  0 )  & &  ( con - > prev ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										show_downbut =  ( con - > next )  ?  1  :  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-09-06 07:26:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* enabled */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-27 13:11:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " mute " ,  0 ,  " " ,  ( con - > flag  &  CONSTRAINT_OFF )  ?  ICON_RESTRICT_VIEW_ON  :  ICON_RESTRICT_VIEW_OFF ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-06 07:26:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiLayoutSetOperatorContext ( row ,  WM_OP_INVOKE_DEFAULT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 09:42:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* up/down */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( show_upbut  | |  show_downbut )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( show_upbut ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemO ( row ,  " " ,  ICON_TRIA_UP ,  " CONSTRAINT_OT_move_up " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( show_downbut ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemO ( row ,  " " ,  ICON_TRIA_DOWN ,  " CONSTRAINT_OT_move_down " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* Close 'button' - emboss calls here disable drawing of 'button' behind X */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemO ( row ,  " " ,  ICON_X ,  " CONSTRAINT_OT_delete " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-07 14:10:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Set but-locks for protected settings (magic numbers are used here!) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( proxy_protected ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetButLock ( block ,  1 ,  " Cannot edit Proxy-Protected Constraint " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-09 08:33:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Draw constraint data */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ( con - > flag  &  CONSTRAINT_EXPAND )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										( yco )  - =  21 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										box =  uiLayoutBox ( col ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 10:45:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										block =  uiLayoutAbsoluteBlock ( box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-09 08:33:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										result =  box ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-11 17:47:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-09 08:33:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* clear any locks set up for proxies/lib-linking */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockClearButLock ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  result ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								uiLayout  * uiTemplateConstraint ( uiLayout  * layout ,  PointerRNA  * ptr )  
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bConstraint  * con ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* verify we have valid data */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! RNA_struct_is_a ( ptr - > type ,  & RNA_Constraint ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Expected constraint on object " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob =  ptr - > id . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									con =  ptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! ob  | |  ! ( GS ( ob - > id . name )  = =  ID_OB ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Expected constraint on object " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:37:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetButLock ( uiLayoutGetBlock ( layout ) ,  ( ob  & &  ob - > id . lib ) ,  ERROR_LIBDATA_MESSAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* hrms, the temporal constraint should not draw! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( con - > type = = CONSTRAINT_TYPE_KINEMATIC )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bKinematicConstraint  * data =  con - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( data - > flag  &  CONSTRAINT_IK_TEMP ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-16 23:28:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									return  draw_constraint ( layout ,  ob ,  con ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************* Preview Template ***************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_lamp_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_material_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_world_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_MATPRV 1 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 11:12:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  do_preview_buttons ( bContext  * C ,  void  * arg ,  int  event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  B_MATPRV : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											WM_event_add_notifier ( C ,  NC_MATERIAL | ND_SHADING ,  arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:46:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplatePreview ( uiLayout  * layout ,  ID  * id ,  int  show_buttons ,  ID  * parent ,  MTex  * slot )  
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * row ,  * col ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Material  * ma =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Tex  * tex  =  ( Tex * ) id ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * pid ,  * pparent ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									short  * pr_texture =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PointerRNA  material_ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  texture_ptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( id  & &  ! ELEM4 ( GS ( id - > name ) ,  ID_MA ,  ID_TE ,  ID_WO ,  ID_LA ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Expected ID of type material, texture, lamp or world " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* decide what to render */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pid =  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pparent =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( id  & &  ( GS ( id - > name )  = =  ID_TE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( parent  & &  ( GS ( parent - > name )  = =  ID_MA ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											pr_texture =  & ( ( Material * ) parent ) - > pr_texture ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  if ( parent  & &  ( GS ( parent - > name )  = =  ID_WO ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											pr_texture =  & ( ( World * ) parent ) - > pr_texture ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  if ( parent  & &  ( GS ( parent - > name )  = =  ID_LA ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											pr_texture =  & ( ( Lamp * ) parent ) - > pr_texture ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( pr_texture )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( * pr_texture  = =  TEX_PR_OTHER ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												pid =  parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  if ( * pr_texture  = =  TEX_PR_BOTH ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												pparent =  parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* layout */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									col =  uiLayoutColumn ( row ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayoutSetKeepAspect ( col ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-08 10:00:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* add preview */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefBut ( block ,  BUT_EXTRA ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X * 6 ,  UI_UNIT_Y * 6 ,  pid ,  0.0 ,  0.0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-18 19:58:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetDrawExtraFunc ( block ,  ED_preview_draw ,  pparent ,  slot ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 11:12:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetHandleFunc ( block ,  do_preview_buttons ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* add buttons */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-19 07:46:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( pid  & &  show_buttons )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 13:20:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( GS ( pid - > name )  = =  ID_MA  | |  ( pparent  & &  GS ( pparent - > name )  = =  ID_MA ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( GS ( pid - > name )  = =  ID_MA )  ma =  ( Material * ) pid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  ma =  ( Material * ) pparent ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* Create RNA Pointer */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_pointer_create ( id ,  & RNA_Material ,  ma ,  & material_ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											col  =  uiLayoutColumn ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiLayoutSetScaleX ( col ,  1.5 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemR ( col ,  & material_ptr ,  " preview_render_type " ,  UI_ITEM_R_EXPAND ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( pr_texture )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* Create RNA Pointer */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_pointer_create ( id ,  & RNA_Texture ,  tex ,  & texture_ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiDefButS ( block ,  ROW ,  B_MATPRV ,  IFACE_ ( " Texture " ) ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_TEXTURE ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( GS ( parent - > name )  = =  ID_MA ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiDefButS ( block ,  ROW ,  B_MATPRV ,  IFACE_ ( " Material " ) ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_OTHER ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if ( GS ( parent - > name )  = =  ID_LA ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiDefButS ( block ,  ROW ,  B_MATPRV ,  IFACE_ ( " Lamp " ) ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_OTHER ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											else  if ( GS ( parent - > name )  = =  ID_WO ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiDefButS ( block ,  ROW ,  B_MATPRV ,  IFACE_ ( " World " ) ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_OTHER ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiDefButS ( block ,  ROW ,  B_MATPRV ,  IFACE_ ( " Both " ) ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_BOTH ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2011-12-04 16:55:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* Alpha button for texture preview */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( * pr_texture ! = TEX_PR_OTHER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												row  =  uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemR ( row ,  & texture_ptr ,  " use_preview_alpha " ,  0 ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-28 23:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************** ColorRamp Template **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								typedef  struct  RNAUpdateCb  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  RNAUpdateCb ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  rna_update_cb ( bContext  * C ,  void  * arg_cb ,  void  * UNUSED ( arg ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb =  ( RNAUpdateCb * ) arg_cb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* we call update here on the pointer property, this way the
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 16:31:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *  owner  of  the  curve  mapping  can  still  define  it ' s  own  update 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  and  notifier ,  even  if  the  CurveMapping  struct  is  shared .  */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_property_update ( C ,  & cb - > ptr ,  cb - > prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_BANDCOL 1 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  colorband_add_cb ( bContext  * C ,  void  * cb_v ,  void  * coba_v )  
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ColorBand  * coba =  coba_v ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-30 00:20:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  pos =  0.5f ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-30 00:20:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( coba - > tot  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( coba - > cur  >  0 ) 	pos =  ( coba - > data [ coba - > cur - 1 ] . pos  +  coba - > data [ coba - > cur ] . pos )  *  0.5f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 				pos =  ( coba - > data [ coba - > cur + 1 ] . pos  +  coba - > data [ coba - > cur ] . pos )  *  0.5f ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-28 09:29:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-30 00:20:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( colorband_element_add ( coba ,  pos ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ED_undo_push ( C ,  " Add colorband " ) ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  colorband_del_cb ( bContext  * C ,  void  * cb_v ,  void  * coba_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ColorBand  * coba =  coba_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-30 00:20:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( colorband_element_remove ( coba ,  coba - > cur ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ED_undo_push ( C ,  " Delete colorband " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-28 16:07:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  colorband_flip_cb ( bContext  * C ,  void  * cb_v ,  void  * coba_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CBData  data_tmp [ MAXCOLORBAND ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ColorBand  * coba =  coba_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( a = 0 ;  a < coba - > tot ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										data_tmp [ a ] =  coba - > data [ coba - > tot  -  ( a  +  1 ) ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( a = 0 ;  a < coba - > tot ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										data_tmp [ a ] . pos  =  1.0f  -  data_tmp [ a ] . pos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										coba - > data [ a ] =  data_tmp [ a ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* may as well flip the cur*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									coba - > cur =  coba - > tot  -  ( coba - > cur  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_undo_push ( C ,  " Flip colorband " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-02 14:07:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  colorband_update_cb ( bContext  * UNUSED ( C ) ,  void  * bt_v ,  void  * coba_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt =  bt_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ColorBand  * coba =  coba_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* sneaky update here, we need to sort the colorband points to be in order,
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 16:31:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *  however  the  RNA  pointer  then  is  wrong ,  so  we  update  it  */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-02 14:07:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									colorband_update_sort ( coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt - > rnapoin . data  =  coba - > data  +  coba - > cur ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* offset aligns from bottom, standard width 300, height 115 */  
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  colorband_buttons_large ( uiLayout  * layout ,  uiBlock  * block ,  ColorBand  * coba ,  int  xoffs ,  int  yoffs ,  RNAUpdateCb  * cb )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-12 12:08:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * row ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-05 13:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  int  line1_y =  yoffs  +  65  +  UI_UNIT_Y  +  2 ;  /* 2 for some space between the buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  int  line2_y =  yoffs  +  65 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( coba = = NULL )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	IFACE_ ( " Add " ) ,  0 + xoffs , line1_y , 40 , UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TIP_ ( " Add a new color stop to the colorband " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_add_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	IFACE_ ( " Delete " ) ,  45 + xoffs , line1_y , 45 , UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TIP_ ( " Delete the active position " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_del_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-28 16:07:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* XXX, todo for later - convert to operator - campbell */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	" F " , 		95 + xoffs , line1_y , 20 , UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 ,  TIP_ ( " Flip colorband " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-28 16:07:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_flip_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefButS ( block ,  NUM ,  0 , 		" " , 				120 + xoffs , line1_y , 80 ,  UI_UNIT_Y ,  & coba - > cur ,  0.0 ,  ( float ) ( MAX2 ( 0 ,  coba - > tot - 1 ) ) ,  0 ,  0 ,  TIP_ ( " Choose active color stop " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefButS ( block ,  MENU ,  0 , 		IFACE_ ( " Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4 " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											210 + xoffs ,  line1_y ,  90 ,  UI_UNIT_Y , 		& coba - > ipotype ,  0.0 ,  0.0 ,  0 ,  0 ,  TIP_ ( " Set interpolation between color stops " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-05 13:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT_COLORBAND ,  0 ,  " " ,  	xoffs , line2_y , 300 , UI_UNIT_Y ,  coba ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-28 16:07:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( coba - > tot )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CBData  * cbd =  coba - > data  +  coba - > cur ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* better to use rna so we can animate them */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_pointer_create ( cb - > ptr . id . data ,  & RNA_ColorRampElement ,  cbd ,  & ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-12 12:08:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row =  uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-02 14:07:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " position " ,  0 ,  " Pos " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-02 14:07:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bt =  block - > buttons . last ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiButSetFunc ( bt ,  colorband_update_cb ,  bt ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " color " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  colorband_buttons_small ( uiLayout  * layout ,  uiBlock  * block ,  ColorBand  * coba ,  rctf  * butr ,  RNAUpdateCb  * cb )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  unit =  ( butr - > xmax - butr - > xmin ) / 14.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  xs =  butr - > xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-12 12:08:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	IFACE_ ( " Add " ) ,  xs , butr - > ymin + UI_UNIT_Y , 2.0f * unit , UI_UNIT_Y , 	NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											TIP_ ( " Add a new color stop to the colorband " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_add_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	IFACE_ ( " Delete " ) ,  xs + 2.0f * unit , butr - > ymin + UI_UNIT_Y , 1.5f * unit , UI_UNIT_Y , 	NULL ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									             TIP_ ( " Delete the active position " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_del_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	" F " , 		xs + 3.5f * unit , butr - > ymin + UI_UNIT_Y , 0.5f * unit , UI_UNIT_Y , 	NULL ,  0 ,  0 ,  0 ,  0 ,  TIP_ ( " Flip the color ramp " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-28 16:07:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_flip_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-12 12:08:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( coba - > tot )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CBData  * cbd =  coba - > data  +  coba - > cur ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_pointer_create ( cb - > ptr . id . data ,  & RNA_ColorRampElement ,  cbd ,  & ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( layout ,  & ptr ,  " color " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefButS ( block ,  MENU ,  0 ,  TIP_ ( " Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4 " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 15:10:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											xs + 10.0f * unit ,  butr - > ymin + UI_UNIT_Y ,  unit * 4 ,  UI_UNIT_Y , 		& coba - > ipotype ,  0.0 ,  0.0 ,  0 ,  0 , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											TIP_ ( " Set interpolation between color stops " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-05 13:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT_COLORBAND ,  0 ,  " " , 		xs , butr - > ymin , butr - > xmax - butr - > xmin , UI_UNIT_Y ,  coba ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  colorband_buttons_layout ( uiLayout  * layout ,  uiBlock  * block ,  ColorBand  * coba ,  rctf  * butr ,  int  small ,  RNAUpdateCb  * cb )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( small ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										colorband_buttons_small ( layout ,  block ,  coba ,  butr ,  cb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										colorband_buttons_large ( layout ,  block ,  coba ,  0 ,  0 ,  cb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateColorRamp ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname ,  int  expand )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  cptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rctf  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( ! prop  | |  RNA_property_type ( prop )  ! =  PROP_POINTER ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cptr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! cptr . data  | |  ! RNA_struct_is_a ( cptr . type ,  & RNA_ColorRamp ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb =  MEM_callocN ( sizeof ( RNAUpdateCb ) ,  " RNAUpdateCb " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > ptr =  * ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > prop =  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . xmin =  0 ;  rect . xmax =  200 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . ymin =  0 ;  rect . ymax =  190 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 10:45:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutAbsoluteBlock ( layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-11 02:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									colorband_buttons_layout ( layout ,  block ,  cptr . data ,  & rect ,  ! expand ,  cb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( cb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-19 01:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************* Histogram Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateHistogram ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname )  
						 
					
						
							
								
									
										
										
										
											2010-01-19 01:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  cptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Histogram  * hist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rctf  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! prop  | |  RNA_property_type ( prop )  ! =  PROP_POINTER ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cptr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! cptr . data  | |  ! RNA_struct_is_a ( cptr . type ,  & RNA_Histogram ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb =  MEM_callocN ( sizeof ( RNAUpdateCb ) ,  " RNAUpdateCb " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > ptr =  * ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > prop =  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . xmin =  0 ;  rect . xmax =  200 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . ymin =  0 ;  rect . ymax =  190 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutAbsoluteBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//colorband_buttons_layout(layout, block, cptr.data, &rect, !expand, cb);
 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-19 01:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hist  =  ( Histogram  * ) cptr . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-05 13:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									hist - > height =  ( hist - > height < = UI_UNIT_Y ) ? UI_UNIT_Y : hist - > height ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  HISTOGRAM ,  0 ,  " " ,  rect . xmin ,  rect . ymin ,  rect . xmax - rect . xmin ,  hist - > height ,  hist ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************* Waveform Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateWaveform ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname )  
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  cptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scopes  * scopes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rctf  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! prop  | |  RNA_property_type ( prop )  ! =  PROP_POINTER ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-19 01:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cptr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! cptr . data  | |  ! RNA_struct_is_a ( cptr . type ,  & RNA_Scopes ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scopes  =  ( Scopes  * ) cptr . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb =  MEM_callocN ( sizeof ( RNAUpdateCb ) ,  " RNAUpdateCb " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > ptr =  * ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > prop =  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . xmin =  0 ;  rect . xmax =  200 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . ymin =  0 ;  rect . ymax =  190 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutAbsoluteBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-06-05 13:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scopes - > wavefrm_height =  ( scopes - > wavefrm_height < = UI_UNIT_Y ) ? UI_UNIT_Y : scopes - > wavefrm_height ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  WAVEFORM ,  0 ,  " " ,  rect . xmin ,  rect . ymin ,  rect . xmax - rect . xmin ,  scopes - > wavefrm_height ,  scopes ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-28 02:34:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									( void ) bt ;  // UNUSED
 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************* Vectorscope Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateVectorscope ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname )  
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  cptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scopes  * scopes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rctf  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! prop  | |  RNA_property_type ( prop )  ! =  PROP_POINTER ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cptr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! cptr . data  | |  ! RNA_struct_is_a ( cptr . type ,  & RNA_Scopes ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scopes  =  ( Scopes  * ) cptr . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb =  MEM_callocN ( sizeof ( RNAUpdateCb ) ,  " RNAUpdateCb " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > ptr =  * ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > prop =  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . xmin =  0 ;  rect . xmax =  200 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rect . ymin =  0 ;  rect . ymax =  190 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutAbsoluteBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-05 13:20:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									scopes - > vecscope_height =  ( scopes - > vecscope_height < = UI_UNIT_Y ) ? UI_UNIT_Y : scopes - > vecscope_height ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 02:37:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  VECTORSCOPE ,  0 ,  " " ,  rect . xmin ,  rect . ymin ,  rect . xmax - rect . xmin ,  scopes - > vecscope_height ,  scopes ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-19 01:32:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************* CurveMapping Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_zoom_in ( bContext  * C ,  void  * cumap_v ,  void  * UNUSED ( arg ) )  
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* we allow 20 times zoom */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if (  ( cumap - > curr . xmax  -  cumap - > curr . xmin )  >  0.04f * ( cumap - > clipr . xmax  -  cumap - > clipr . xmin )  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										d =  0.1154f * ( cumap - > curr . xmax  -  cumap - > curr . xmin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . xmin + =  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . xmax - =  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										d =  0.1154f * ( cumap - > curr . ymax  -  cumap - > curr . ymin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . ymin + =  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . ymax - =  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_zoom_out ( bContext  * C ,  void  * cumap_v ,  void  * UNUSED ( unused ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  d ,  d1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* we allow 20 times zoom, but don't view outside clip */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if (  ( cumap - > curr . xmax  -  cumap - > curr . xmin )  <  20.0f * ( cumap - > clipr . xmax  -  cumap - > clipr . xmin )  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										d =  d1 =  0.15f * ( cumap - > curr . xmax  -  cumap - > curr . xmin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > flag  &  CUMA_DO_CLIP )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( cumap - > curr . xmin - d  <  cumap - > clipr . xmin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												d1 =  cumap - > curr . xmin  -  cumap - > clipr . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . xmin - =  d1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										d1 =  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > flag  &  CUMA_DO_CLIP )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( cumap - > curr . xmax + d  >  cumap - > clipr . xmax ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												d1 =  - cumap - > curr . xmax  +  cumap - > clipr . xmax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . xmax + =  d1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										d =  d1 =  0.15f * ( cumap - > curr . ymax  -  cumap - > curr . ymin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > flag  &  CUMA_DO_CLIP )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( cumap - > curr . ymin - d  <  cumap - > clipr . ymin ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												d1 =  cumap - > curr . ymin  -  cumap - > clipr . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . ymin - =  d1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										d1 =  d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > flag  &  CUMA_DO_CLIP )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( cumap - > curr . ymax + d  >  cumap - > clipr . ymax ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												d1 =  - cumap - > curr . ymax  +  cumap - > clipr . ymax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										cumap - > curr . ymax + =  d1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_setclip ( bContext  * UNUSED ( C ) ,  void  * cumap_v ,  void  * UNUSED ( arg ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								} 	 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  curvemap_buttons_delete ( bContext  * C ,  void  * cb_v ,  void  * cumap_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									curvemap_remove ( cumap - > cm + cumap - > cur ,  SELECT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  uiBlock  * curvemap_clipping_func ( bContext  * C ,  struct  ARegion  * ar ,  void  * cumap_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  width =  8 * UI_UNIT_X ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block  =  uiBeginBlock ( C ,  ar ,  __func__ ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* use this for a fake extra empy space around the buttons */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefBut ( block ,  LABEL ,  0 ,  " " , 			- 4 ,  16 ,  width + 8 ,  6 * UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefButBitI ( block ,  TOG ,  CUMA_DO_CLIP ,  1 ,  " Use Clipping " , 	 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											0 , 5 * UI_UNIT_Y , width , UI_UNIT_Y ,  & cumap - > flag ,  0.0 ,  0.0 ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetFunc ( bt ,  curvemap_buttons_setclip ,  cumap ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  IFACE_ ( " Min X  " ) , 	 0 , 4 * UI_UNIT_Y , width , UI_UNIT_Y ,  & cumap - > clipr . xmin ,  - 100.0 ,  cumap - > clipr . xmax ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  IFACE_ ( " Min Y  " ) , 	 0 , 3 * UI_UNIT_Y , width , UI_UNIT_Y ,  & cumap - > clipr . ymin ,  - 100.0 ,  cumap - > clipr . ymax ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  IFACE_ ( " Max X  " ) , 	 0 , 2 * UI_UNIT_Y , width , UI_UNIT_Y ,  & cumap - > clipr . xmax ,  cumap - > clipr . xmin ,  100.0 ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  IFACE_ ( " Max Y  " ) , 	 0 , UI_UNIT_Y , width , UI_UNIT_Y ,  & cumap - > clipr . ymax ,  cumap - > clipr . ymin ,  100.0 ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetDirection ( block ,  UI_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiEndBlock ( C ,  block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  curvemap_tools_dofunc ( bContext  * C ,  void  * cumap_v ,  int  event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMap  * cuma =  cumap - > cm + cumap - > cur ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  0 :  /* reset */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-30 00:06:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											curvemap_reset ( cuma ,  & cumap - > clipr , 	cumap - > preset ,  CURVEMAP_SLOPE_POSITIVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cumap - > curr =  cumap - > clipr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  2 : 	/* set vector */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curvemap_sethandle ( cuma ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  3 :  /* set auto */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curvemap_sethandle ( cuma ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  4 :  /* extend horiz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cuma - > flag  & =  ~ CUMA_EXTEND_EXTRAPOLATE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  5 :  /* extend extrapolate */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											cuma - > flag  | =  CUMA_EXTEND_EXTRAPOLATE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  uiBlock  * curvemap_tools_func ( bContext  * C ,  struct  ARegion  * ar ,  void  * cumap_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									short  yco =  0 ,  menuwidth = 10 * UI_UNIT_X ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiBeginBlock ( C ,  ar ,  __func__ ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetButmFunc ( block ,  curvemap_tools_dofunc ,  cumap_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Reset View " ) , 			0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  1 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Vector Handle " ) , 		0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  2 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Auto Handle " ) , 			0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  3 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Extend Horizontal " ) , 	0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  4 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Extend Extrapolated " ) , 	0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  5 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Reset Curve " ) , 			0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetDirection ( block ,  UI_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiTextBoundsBlock ( block ,  50 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiEndBlock ( C ,  block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  uiBlock  * curvemap_brush_tools_func ( bContext  * C ,  struct  ARegion  * ar ,  void  * cumap_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									short  yco =  0 ,  menuwidth = 10 * UI_UNIT_X ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiBeginBlock ( C ,  ar ,  __func__ ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetButmFunc ( block ,  curvemap_tools_dofunc ,  cumap_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Reset View " ) , 		0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  1 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Vector Handle " ) , 	0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  2 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Auto Handle " ) , 		0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  3 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  IFACE_ ( " Reset Curve " ) , 		0 ,  yco - = UI_UNIT_Y ,  menuwidth ,  UI_UNIT_Y ,  NULL ,  0.0 ,  0.0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetDirection ( block ,  UI_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiTextBoundsBlock ( block ,  50 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiEndBlock ( C ,  block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_redraw ( bContext  * C ,  void  * UNUSED ( arg1 ) ,  void  * UNUSED ( arg2 ) )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  curvemap_buttons_reset ( bContext  * C ,  void  * cb_v ,  void  * cumap_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 07:41:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cumap - > preset  =  CURVE_PRESET_LINE ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									for ( a = 0 ;  a < CM_TOT ;  a + + ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-30 00:06:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										curvemap_reset ( cumap - > cm + a ,  & cumap - > clipr ,  cumap - > preset ,  CURVEMAP_SLOPE_POSITIVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cumap - > black [ 0 ] = cumap - > black [ 1 ] = cumap - > black [ 2 ] =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cumap - > white [ 0 ] = cumap - > white [ 1 ] = cumap - > white [ 2 ] =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									curvemapping_set_black_white ( cumap ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									curvemapping_changed ( cumap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */  
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_layout ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  labeltype ,  int  levels ,  int  brush ,  RNAUpdateCb  * cb )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap =  ptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * row ,  * sub ,  * split ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  dx =  UI_UNIT_X ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  icon ,  size ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 00:00:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  bg = - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* curve chooser */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( labeltype = = ' v ' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* vector */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sub =  uiLayoutRow ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetAlignment ( sub ,  UI_LAYOUT_ALIGN_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 0 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " X " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 20:48:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( cumap - > cm [ 1 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " Y " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  1.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 2 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " Z " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  2.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( labeltype = = ' c ' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* color */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sub =  uiLayoutRow ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetAlignment ( sub ,  UI_LAYOUT_ALIGN_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 3 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " C " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  3.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 0 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " R " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 1 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " G " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  1.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 2 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " B " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  2.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-10 20:48:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 22:23:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( labeltype  = =  ' h ' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* HSV */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sub =  uiLayoutRow ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetAlignment ( sub ,  UI_LAYOUT_ALIGN_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 0 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " H " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 22:23:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 1 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " S " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  1.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 22:23:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 2 ] . curve )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-24 03:30:50 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " V " ,  0 ,  0 ,  dx ,  dx ,  & cumap - > cur ,  0.0 ,  2.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 22:23:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetAlignment ( row ,  UI_LAYOUT_ALIGN_RIGHT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 00:00:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( labeltype = = ' h ' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bg  =  UI_GRAD_H ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* operation buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub =  uiLayoutRow ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_ZOOMIN ,  0 ,  0 ,  dx ,  dx ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  TIP_ ( " Zoom in " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetFunc ( bt ,  curvemap_buttons_zoom_in ,  cumap ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_ZOOMOUT ,  0 ,  0 ,  dx ,  dx ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  TIP_ ( " Zoom out " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetFunc ( bt ,  curvemap_buttons_zoom_out ,  cumap ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( brush ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bt =  uiDefIconBlockBut ( block ,  curvemap_brush_tools_func ,  cumap ,  0 ,  ICON_MODIFIER ,  0 ,  0 ,  dx ,  dx ,  TIP_ ( " Tools " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bt =  uiDefIconBlockBut ( block ,  curvemap_tools_func ,  cumap ,  0 ,  ICON_MODIFIER ,  0 ,  0 ,  dx ,  dx ,  TIP_ ( " Tools " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( cumap - > flag  &  CUMA_DO_CLIP )  icon =  ICON_CLIPUV_HLT ;  else  icon =  ICON_CLIPUV_DEHLT ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefIconBlockBut ( block ,  curvemap_clipping_func ,  cumap ,  0 ,  icon ,  0 ,  0 ,  dx ,  dx ,  TIP_ ( " Clipping Options " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_X ,  0 ,  0 ,  dx ,  dx ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  TIP_ ( " Delete points " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  curvemap_buttons_delete ,  MEM_dupallocN ( cb ) ,  cumap ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetNFunc ( block ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* curve itself */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									size =  uiLayoutGetWidth ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-21 00:00:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefBut ( block ,  BUT_CURVE ,  0 ,  " " ,  0 ,  0 ,  size ,  MIN2 ( size ,  200 ) ,  cumap ,  0.0f ,  1.0f ,  bg ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* black/white levels */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( levels )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-10 14:47:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										split =  uiLayoutSplit ( layout ,  0 ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( uiLayoutColumn ( split ,  0 ) ,  ptr ,  " black_level " ,  UI_ITEM_R_EXPAND ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemR ( uiLayoutColumn ( split ,  0 ) ,  ptr ,  " white_level " ,  UI_ITEM_R_EXPAND ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bt = uiDefBut ( block ,  BUT ,  0 ,  IFACE_ ( " Reset " ) , 	0 ,  0 ,  UI_UNIT_X * 10 ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TIP_ ( " Reset Black/White point and curves " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiButSetNFunc ( bt ,  curvemap_buttons_reset ,  MEM_dupallocN ( cb ) ,  cumap ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetNFunc ( block ,  NULL ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateCurveMapping ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname ,  int  type ,  int  levels ,  int  brush )  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  cptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-25 04:36:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( ! prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " curve property not found: %s.%s " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										            RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-25 04:36:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( RNA_property_type ( prop )  ! =  PROP_POINTER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " curve is not a pointer: %s.%s " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										            RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-25 04:36:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cptr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! cptr . data  | |  ! RNA_struct_is_a ( cptr . type ,  & RNA_CurveMapping ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb =  MEM_callocN ( sizeof ( RNAUpdateCb ) ,  " RNAUpdateCb " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > ptr =  * ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cb - > prop =  prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									curvemap_buttons_layout ( layout ,  & cptr ,  type ,  levels ,  brush ,  cb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( cb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************* ColorWheel Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define WHEEL_SIZE	100 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateColorWheel ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname ,  int  value_slider ,  int  lock ,  int  lock_luminosity ,  int  cubic )  
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 22:42:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * col ,  * row ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 20:59:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-27 00:22:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  softmin ,  softmax ,  step ,  precision ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 07:08:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-27 00:22:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									RNA_property_float_ui_range ( ptr ,  prop ,  & softmin ,  & softmax ,  & step ,  & precision ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 22:42:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									col  =  uiLayoutColumn ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( col ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 16:00:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but =  uiDefButR_prop ( block ,  HSVCIRCLE ,  0 ,  " " , 	0 ,  0 ,  WHEEL_SIZE ,  WHEEL_SIZE ,  ptr ,  prop ,  - 1 ,  0.0 ,  0.0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 07:08:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( lock )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but - > flag  | =  UI_BUT_COLOR_LOCK ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 20:59:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( lock_luminosity )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										float  color [ 4 ] ;  /* in case of alpha */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 20:59:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but - > flag  | =  UI_BUT_VEC_SIZE_LOCK ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_property_float_get_array ( ptr ,  prop ,  color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 07:08:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but - > a2 =  len_v3 ( color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 20:59:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-05 15:52:25 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( cubic ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but - > flag  | =  UI_BUT_COLOR_CUBIC ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemS ( row ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( value_slider ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 16:00:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefButR_prop ( block ,  HSVCUBE ,  0 ,  " " ,  WHEEL_SIZE + 6 ,  0 ,  14 ,  WHEEL_SIZE ,  ptr ,  prop ,  - 1 ,  softmin ,  softmax ,  UI_GRAD_V_ALT ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************* Layer Buttons Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  handle_layer_buttons ( bContext  * C ,  void  * arg1 ,  void  * arg2 )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but  =  arg1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  cur  =  GET_INT_FROM_POINTER ( arg2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wmWindow  * win =  CTX_wm_window ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  i ,  tot ,  shift =  win - > eventstate - > shift ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! shift )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										tot =  RNA_property_array_length ( & but - > rnapoin ,  but - > rnaprop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* Normally clicking only selects one layer */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-16 16:12:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_property_boolean_set_index ( & but - > rnapoin ,  but - > rnaprop ,  cur ,  TRUE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for ( i  =  0 ;  i  <  tot ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( i  ! =  cur ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-16 16:12:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												RNA_property_boolean_set_index ( & but - > rnapoin ,  but - > rnaprop ,  i ,  FALSE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-19 16:30:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* view3d layer change should update depsgraph (invisible object changed maybe) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* see view3d_header.c */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// TODO:
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//	- for now, grouping of layers is determined by dividing up the length of 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								//	  the array of layer bitflags
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateLayers ( uiLayout  * layout ,  PointerRNA  * ptr ,  const  char  * propname ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											  PointerRNA  * used_ptr ,  const  char  * used_propname ,  int  active_layer ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * uRow ,  * uCol ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 18:17:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PropertyRNA  * prop ,  * used_prop =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  groups ,  cols ,  layers ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  group ,  col ,  layer ,  row ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  cols_per_group  =  5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-13 04:53:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " layers property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* the number of layers determines the way we group them 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 	-  we  want  2  rows  only  ( for  now ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 	-  the  number  of  columns  ( cols )  is  the  total  number  of  buttons  per  row 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 	  the  ' remainder '  is  added  to  this ,  as  it  will  be  ok  to  have  first  row  slightly  wider  if  need  be 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 * 	-  for  now ,  only  split  into  groups  if  group  will  have  at  least  5  items 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
											
												Implemented dynamic and multidimensional array support in RNA.
Example code: http://www.pasteall.org/7332/c.
New API functions: http://www.pasteall.org/7330/c.
Maximum number of dimensions is currently limited to 3, but can be increased arbitrarily if needed.
What this means for ID property access:
* MeshFace.verts - dynamic array, size 3 or 4 depending on MFace.v4
* MeshTextureFace.uv - dynamic, 2-dimensional array, size depends on MFace.v4
* Object.matrix - 2-dimensional array
What this means for functions:
* more intuitive API possibility, for example:
  Mesh.add_vertices([(x, y, z), (x, y, z), ...])
  Mesh.add_faces([(1, 2, 3), (4, 5, 6), ...])
Python part is not complete yet, e.g. it is possible to:
MeshFace.verts = (1, 2, 3) # even if Mesh.verts is (1, 2, 3, 4) and vice-versa
MeshTextureFace.uv = [(0.0, 0.0)] * 4 # only if a corresponding MFace is a quad
but the following won't work:
MeshTextureFace.uv[3] = (0.0, 0.0) # setting uv[3] modifies MTFace.uv[1][0] instead of MTFace.uv[3]
											 
										 
										
											2009-08-25 17:06:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									layers =  RNA_property_array_length ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									cols =  ( layers  /  2 )  +  ( layers  %  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									groups =  ( ( cols  /  2 )  <  cols_per_group )  ?  ( 1 )  :  ( cols  /  cols_per_group ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( used_ptr  & &  used_propname )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										used_prop =  RNA_struct_find_property ( used_ptr ,  used_propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ! used_prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-09 01:29:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RNA_warning ( " used layers property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  used_propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( RNA_property_array_length ( used_ptr ,  used_prop )  <  layers ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											used_prop  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* layers are laid out going across rows, with the columns being divided into groups */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for  ( group =  0 ;  group  <  groups ;  group + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uCol =  uiLayoutColumn ( layout ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for  ( row =  0 ;  row  <  2 ;  row + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBut  * but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uRow =  uiLayoutRow ( uCol ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											block =  uiLayoutGetBlock ( uRow ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											layer =  groups * cols_per_group * row  +  cols_per_group * group ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* add layers as toggle buts */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											for  ( col =  0 ;  ( col  <  cols_per_group )  & &  ( layer  <  layers ) ;  col + + ,  layer + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  icon  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  butlay  =  1  < <  layer ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( active_layer  &  butlay ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													icon  =  ICON_LAYER_ACTIVE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  if ( used_prop  & &  RNA_property_boolean_get_index ( used_ptr ,  used_prop ,  layer ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													icon  =  ICON_LAYER_USED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
											
												Code holiday commit:
- fix: user pref, window title was reset to 'Blender' on tab usage
- Undo history menu back:
  - name "Undo History"
  - hotkey alt+ctrl+z (alt+apple+z for mac)
  - works like 2.4x, only for global undo, editmode and particle edit.
- Menu scroll
  - for small windows or screens, popup menus now allow to display
    all items, using internal scrolling
  - works with a timer, scrolling 10 items per second when mouse 
    is over the top or bottom arrow
  - if menu is too big to display, it now draws to top or bottom, 
    based on largest available space.
  - also works for hotkey driven pop up menus.
- User pref "DPI" follows widget/layout size
  - widgets & headers now become bigger and smaller, to match 
    'dpi' font sizes. Works well to match UI to monitor size.
  - note that icons can get fuzzy, we need better mipmaps for it
											 
										 
										
											2011-06-04 17:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but =  uiDefAutoButR ( block ,  ptr ,  prop ,  layer ,  " " ,  icon ,  0 ,  0 ,  UI_UNIT_X / 2 ,  UI_UNIT_Y / 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiButSetFunc ( but ,  handle_layer_buttons ,  but ,  SET_INT_IN_POINTER ( layer ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but - > type =  TOG ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-06-22 23:58:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************* List Template **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 19:46:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  list_item_icon_get ( bContext  * C ,  PointerRNA  * itemptr ,  int  rnaicon ,  int  big )  
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ID  * id =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! itemptr - > data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  rnaicon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* try ID, material or texture slot */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( RNA_struct_is_ID ( itemptr - > type ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id =  itemptr - > id . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( RNA_struct_is_a ( itemptr - > type ,  & RNA_MaterialSlot ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id =  RNA_pointer_get ( itemptr ,  " material " ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( RNA_struct_is_a ( itemptr - > type ,  & RNA_TextureSlot ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										id =  RNA_pointer_get ( itemptr ,  " texture " ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( RNA_struct_is_a ( itemptr - > type ,  & RNA_DynamicPaintSurface ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DynamicPaintSurface  * surface =  ( DynamicPaintSurface * ) itemptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( surface - > format  = =  MOD_DPAINT_SURFACE_F_PTEX )  return  ICON_TEXTURE_SHADED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  if  ( surface - > format  = =  MOD_DPAINT_SURFACE_F_VERTEX )  return  ICON_OUTLINER_DATA_MESH ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  if  ( surface - > format  = =  MOD_DPAINT_SURFACE_F_IMAGESEQ )  return  ICON_FILE_IMAGE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* get icon from ID */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 19:46:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon =  ui_id_icon_get ( C ,  id ,  big ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( icon ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  rnaicon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 08:18:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  list_item_row ( bContext  * C ,  uiLayout  * layout ,  PointerRNA  * ptr ,  PointerRNA  * itemptr ,  int  i ,  int  rnaicon ,  PointerRNA  * activeptr ,  PropertyRNA  * activeprop ,  const  char  * prop_list_id )  
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 17:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * split ,  * overlap ,  * sub ,  * row ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 17:05:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  * namebuf ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  char  * name ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									overlap =  uiLayoutOverlap ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* list item behind label & other buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub =  uiLayoutRow ( overlap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 16:00:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but =  uiDefButR_prop ( block ,  LISTROW ,  0 ,  " " ,  0 , 0 ,  UI_UNIT_X * 10 , UI_UNIT_Y ,  activeptr ,  activeprop ,  0 ,  0 ,  i ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetFlag ( but ,  UI_BUT_NO_TOOLTIP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub =  uiLayoutRow ( overlap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* retrieve icon and name */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 19:46:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									icon =  list_item_icon_get ( C ,  itemptr ,  rnaicon ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( icon  = =  ICON_NONE  | |  icon  = =  ICON_DOT ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-22 10:49:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									namebuf =  RNA_struct_name_get_alloc ( itemptr ,  NULL ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									name =  ( namebuf ) ?  namebuf :  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* hardcoded types */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-25 13:28:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( itemptr - > type  = =  & RNA_MeshTexturePolyLayer  | |  itemptr - > type  = =  & RNA_MeshLoopColorLayer )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefIconButR ( block ,  TOG ,  0 ,  ICON_SCENE ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  itemptr ,  " active_render " ,  0 ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( RNA_struct_is_a ( itemptr - > type ,  & RNA_MaterialTextureSlot ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefButR ( block ,  OPTION ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  ptr ,  " use_textures " ,  i ,  0 ,  0 ,  0 ,  0 ,   NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-05 03:09:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( RNA_struct_is_a ( itemptr - > type ,  & RNA_SceneRenderLayer ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-18 07:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefButR ( block ,  OPTION ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  itemptr ,  " use " ,  0 ,  0 ,  0 ,  0 ,  0 ,   NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-05 03:09:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( RNA_struct_is_a ( itemptr - > type ,  & RNA_MaterialSlot ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* provision to draw active node name */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										Material  * ma ,  * manode ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-06 01:07:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Scene  * scene =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Object  * ob =  ( Object * ) ptr - > id . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 15:49:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										int  index =  ( Material * * ) itemptr - > data  -  ob - > mat ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* default item with material base name */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ma =  give_current_material ( ob ,  index + 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-06 01:07:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ma  & &  ! scene_use_new_shading_nodes ( scene ) ) { 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											manode =  give_node_material ( ma ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( manode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												char  str [ MAX_ID_NAME  +  12 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:53:04 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BLI_snprintf ( str ,  sizeof ( str ) ,  " Node %s " ,  manode - > id . name + 2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemL ( sub ,  str ,  ui_id_icon_get ( C ,  & manode - > id ,  1 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  if ( ma - > use_nodes )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemL ( sub ,  " Node <none> " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-18 16:38:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( itemptr - > type  = =  & RNA_ShapeKey )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 12:30:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Object  * ob =  ( Object * ) activeptr - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-10 20:12:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Key  * key =  ( Key * ) itemptr - > id . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-30 09:49:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										split =  uiLayoutSplit ( sub ,  0.66f ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( split ,  name ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 17:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row =  uiLayoutRow ( split ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-07 11:01:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( i  = =  0  | |  ( key - > type  ! =  KEY_RELATIVE ) )  uiItemL ( row ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  uiItemR ( row ,  itemptr ,  " value " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-30 09:49:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  itemptr ,  " mute " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 17:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-30 09:49:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if (  ( key - > flag  &  KEYBLOCK_MUTE )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										    ( ob - > mode  = =  OB_MODE_EDIT  & &  ! ( ( ob - > shapeflag  &  OB_SHAPE_EDIT_MODE )  & &  ob - > type  = =  OB_MESH ) )  ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 17:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiLayoutSetActive ( row ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-30 09:49:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 07:07:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( itemptr - > type  = =  & RNA_VertexGroup )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 08:21:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										bDeformGroup  * dg =  ( bDeformGroup  * ) itemptr - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-13 20:28:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 08:21:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* RNA does not allow nice lock icons, use lower level buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								#if 0 
  
						 
					
						
							
								
									
										
										
										
											2011-09-14 07:07:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefButR ( block ,  OPTION ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  itemptr ,  " lock_weight " ,  0 ,  0 ,  0 ,  0 ,  0 ,   NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 08:21:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# else 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconButBitC ( block ,  TOG ,  DG_LOCK_WEIGHT ,  0 ,  ( dg - > flag  &  DG_LOCK_WEIGHT )  ?  ICON_LOCKED  :  ICON_UNLOCKED ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  & dg - > flag ,  0 ,  0 ,  0 ,  0 ,  " Maintain relative weights while painting " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# endif 
  
						 
					
						
							
								
									
										
										
										
											2011-09-13 20:28:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-01 03:35:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( itemptr - > type  = =  & RNA_KeyingSetPath )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										KS_Path  * ksp  =  ( KS_Path * ) itemptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* icon needs to be the type of ID which is currently active */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_enum_icon_from_value ( id_type_items ,  ksp - > idtype ,  & icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* nothing else special to do... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ;  /* fails, backdrop LISTROW... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( itemptr - > type  = =  & RNA_DynamicPaintSurface )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										char  name_final [ 96 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-10 16:08:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										const  char  * enum_name ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										PropertyRNA  * prop  =  RNA_struct_find_property ( itemptr ,  " surface_type " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DynamicPaintSurface  * surface =  ( DynamicPaintSurface * ) itemptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_property_enum_name ( C ,  itemptr ,  prop ,  RNA_property_enum_get ( itemptr ,  prop ) ,  & enum_name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-05 07:39:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_snprintf ( name_final ,  sizeof ( name_final ) ,  " %s (%s) " , name , enum_name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( sub ,  name_final ,  icon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-03 14:01:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( dynamicPaint_surfaceHasColorPreview ( surface ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-16 10:41:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiDefIconButR ( block ,  OPTION ,  0 ,  ( surface - > flags  &  MOD_DPAINT_PREVIEW )  ?  ICON_RESTRICT_VIEW_OFF  :  ICON_RESTRICT_VIEW_ON , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  itemptr ,  " show_preview " ,  0 ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefButR ( block ,  OPTION ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  itemptr ,  " is_active " ,  i ,  0 ,  0 ,  0 ,  0 ,   NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-12-05 18:57:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( itemptr - > type  = =  & RNA_MovieTrackingObject )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MovieTrackingObject  * tracking_object =  ( MovieTrackingObject * ) itemptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										split =  uiLayoutSplit ( sub ,  0.75f ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( tracking_object - > flag & TRACKING_OBJECT_CAMERA )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemL ( split ,  name ,  ICON_CAMERA_DATA ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemL ( split ,  name ,  ICON_OBJECT_DATA ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 17:00:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* There is a last chance to display custom controls (in addition to the name/label):
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  If  the  given  item  property  group  features  a  string  property  named  as  prop_list , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  this  tries  to  add  controls  for  all  properties  of  the  item  listed  in  that  string  property . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  ( colon - separated  names ) . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  This  is  especially  useful  for  python .  E . g . ,  if  you  list  a  collection  of  this  property 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  group : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  class  TestPropertyGroup ( bpy . types . PropertyGroup ) : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *      bool     =  BoolProperty ( default = False ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *      integer  =  IntProperty ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *      string   =  StringProperty ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *      #  A  string  of  all  identifiers  ( colon - separated )  which  property ' s  controls  should  be 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *      #  displayed  in  a  template_list . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *      template_list_controls  =  StringProperty ( default = " integer:bool:string " ,  options = { " HIDDEN " } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 * 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *  . . .  you ' ll  get  a  numfield  for  the  integer  prop ,  a  check  box  for  the  bool  prop ,  and  a  textfield 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									 *  for  the  string  prop ,  after  the  name  of  each  item  of  the  collection . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 08:18:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if  ( prop_list_id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row  =  uiLayoutRow ( sub ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( row ,  name ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* XXX: Check, as sometimes we get an itemptr looking like
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 *       { id  =  { data  =  0x0 } ,  type  =  0x0 ,  data  =  0x0 } 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *       which  would  obviously  produce  a  sigsev . . .  */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( itemptr - > type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											/* If the special property is set for the item, and it is a collection... */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 08:18:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											PropertyRNA  * prop_list =  RNA_struct_find_property ( itemptr ,  prop_list_id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( prop_list  & &  RNA_property_type ( prop_list )  = =  PROP_STRING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  prop_names_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												char  * prop_names  =  RNA_property_string_get_alloc ( itemptr ,  prop_list ,  NULL ,  0 ,  & prop_names_len ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												char  * prop_names_end =  prop_names  +  prop_names_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												char  * id =  prop_names ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												char  * id_next ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												while  ( id  <  prop_names_end )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( ( id_next =  strchr ( id ,  ' : ' ) ) )  * id_next + + =  ' \0 ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													else  id_next =  prop_names_end ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													uiItemR ( row ,  itemptr ,  id ,  0 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													id =  id_next ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-29 08:18:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												MEM_freeN ( prop_names ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-29 16:25:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( sub ,  name ,  icon ) ;  /* fails, backdrop LISTROW... */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* free name */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-21 22:00:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( namebuf )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										MEM_freeN ( namebuf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-21 22:00:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateList ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  const  char  * propname ,  PointerRNA  * activeptr ,  const  char  * activepropname ,  const  char  * prop_list ,  int  rows ,  int  maxrows ,  int  listtype )  
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									//Scene *scene= CTX_data_scene(C);
 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PropertyRNA  * prop =  NULL ,  * activeprop ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PropertyType  type ,  activetype ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-15 19:20:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									StructRNA  * ptype ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * box ,  * row ,  * col ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Panel  * pa ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  char  * name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									char  numstr [ 32 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  rnaicon = 0 ,  icon = 0 ,  i =  0 ,  activei =  0 ,  len =  0 ,  items ,  found ,  min ,  max ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* validate arguments */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									pa =  block - > panel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! pa )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Only works inside a panel " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! activeptr - > data ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ptr - > data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ! prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RNA_warning ( " Property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									activeprop =  RNA_struct_find_property ( activeptr ,  activepropname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( ! activeprop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Property not found: %s.%s " ,  RNA_struct_identifier ( ptr - > type ) ,  activepropname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										type =  RNA_property_type ( prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( type  ! =  PROP_COLLECTION )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RNA_warning ( " uiExpected collection property " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									activetype =  RNA_property_type ( activeprop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( activetype  ! =  PROP_INT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										RNA_warning ( " Expected integer property " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-15 19:20:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* get icon */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ptr - > data  & &  prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ptype =  RNA_property_pointer_type ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										rnaicon =  RNA_struct_ui_icon ( ptype ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-15 19:20:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* get active data */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									activei =  RNA_property_int_get ( activeptr ,  activeprop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( listtype  = =  ' i ' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box =  uiLayoutListBox ( layout ,  ptr ,  prop ,  activeptr ,  activeprop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										col =  uiLayoutColumn ( box ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										row =  uiLayoutRow ( col ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ptr - > data  & &  prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* create list items */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_PROP_BEGIN ( ptr ,  itemptr ,  prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* create button */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-07-26 19:47:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( ! ( i  %  9 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													row =  uiLayoutRow ( col ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 19:46:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												icon =  list_item_icon_get ( C ,  & itemptr ,  rnaicon ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 16:00:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but =  uiDefIconButR_prop ( block ,  LISTROW ,  0 ,  icon ,  0 , 0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  activeptr ,  activeprop ,  0 ,  0 ,  i ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_NO_TOOLTIP ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Drag and drop 2.5 integration! Finally, slashdot regulars can use
Blender too now! :)
** Drag works as follows:
- drag-able items are defined by the standard interface ui toolkit
- each button can get this feature, via uiButSetDragXXX(but, ...).
  There are calls to define drag-able images, ID blocks, RNA paths, 
  file paths, and so on. By default you drag an icon, exceptionally 
  an ImBuf
- Drag items are registered centrally in the WM, it allows more drag 
  items simultaneous too, but not implemented
** Drop works as follows:
- On mouse release, and if drag items exist in the WM, it converts 
  the mouse event to an EVT_DROP type. This event then gets the full 
  drag info as customdata
- drop regions are defined with WM_dropbox_add(), similar to keymaps 
  you can make a "drop map" this way, which become 'drop map handlers' 
  in the queues.
- next to that the UI kit handles some common button types (like 
  accepting ID or names) to be catching a drop event too.
- Every "drop box" has two callbacks:
  - poll() = check if the event drag data is relevant for this box
  - copy() = fill in custom properties in the dropbox to initialize 
    an operator
- The dropbox handler then calls its standard Operator with its 
  dropbox properties.
** Currently implemented
Drag items:
- ID icons in browse buttons
- ID icons in context menu of properties region
- ID icons in outliner and rna viewer
- FileBrowser icons
- FileBrowser preview images
Drag-able icons are subtly visualized by making them brighter a bit 
on mouse-over. In case the icon is a button or UI element too (most 
cases), the drag-able feature will make the item react to 
mouse-release instead of mouse-press. 
Drop options:
- UI buttons: ID and text buttons (paste name)
- View3d: Object ID drop copies object
- View3d: Material ID drop assigns to object under cursor
- View3d: Image ID drop assigns to object UV texture under cursor
- Sequencer: Path drop will add either Image or Movie strip
- Image window: Path drop will open image
** Drag and drop Notes:
- Dropping into another Blender window (from same application) works 
too. I've added code that passes on mousemoves and clicks to other 
windows, without activating them though. This does make using multi-window
Blender a bit friendler.
- Dropping a file path to an image, is not the same as dropping an 
Image ID... keep this in mind. Sequencer for example wants paths to 
be dropped,  textures in 3d window wants an Image ID.
- Although drop boxes could be defined via Python, I suggest they're 
part of the UI and editor design (= how we want an editor to work), and 
not default offered configurable like keymaps. 
- At the moment only one item can be dragged at a time. This is for 
several reasons.... For one, Blender doesn't have a well defined 
uniform way to define "what is selected" (files, outliner items, etc). 
Secondly there's potential conflicts on what todo when you drop mixed 
drag sets on spots. All undefined stuff... nice for later.
- Example to bypass the above: a collection of images that form a strip, 
should be represented in filewindow as a single sequence anyway. 
This then will fit well and gets handled neatly by design.
- Another option to check is to allow multiple options per drop... it 
could show the operator as a sort of menu, allowing arrow or scrollwheel 
to choose. For time being I'd prefer to try to design a singular drop 
though, just offer only one drop action per data type on given spots.
- What does work already, but a tad slow, is to use a function that 
detects an object (type) under cursor, so a drag item's option can be 
further refined (like drop object on object = parent). (disabled)
** More notes
- Added saving for Region layouts (like split points for toolbar)
- Label buttons now handle mouse over
- File list: added full path entry for drop feature.
- Filesel bugfix: wm_operator_exec() got called there and fully handled, 
while WM event code tried same. Added new OPERATOR_HANDLED flag for this. 
Maybe python needs it too?
- Cocoa: added window move event, so multi-win setups work OK (didnt save).
- Interface_handlers.c: removed win->active
- Severe area copy bug: area handlers were not set to NULL
- Filesel bugfix: next/prev folder list was not copied on area copies
** Leftover todos
- Cocoa windows seem to hang on cases still... needs check
- Cocoa 'draw overlap' swap doesn't work
- Cocoa window loses focus permanently on using Spotlight
  (for these reasons, makefile building has Carbon as default atm)
- ListView templates in UI cannot become dragged yet, needs review... 
it consists of two overlapping UI elements, preventing handling icon clicks.
- There's already Ghost library code to handle dropping from OS 
into Blender window. I've noticed this code is unfinished for Macs, but 
seems to be complete for Windows. Needs test... currently, an external 
drop event will print in console when succesfully delivered to Blender's WM.
											 
										 
										
											2010-01-26 18:18:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												i + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_PROP_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( listtype  = =  ' c ' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* compact layout */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ptr - > data  & &  prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* create list items */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_PROP_BEGIN ( ptr ,  itemptr ,  prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												found =  ( activei  = =  i ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( found )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* create button */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-22 10:49:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													name =  RNA_struct_name_get_alloc ( & itemptr ,  NULL ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-02 19:46:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													icon =  list_item_icon_get ( C ,  & itemptr ,  rnaicon ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-15 19:20:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uiItemL ( row ,  ( name ) ?  name :  " " ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-21 22:00:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													if  ( name )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														MEM_freeN ( ( void  * ) name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-21 22:00:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												i + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											RNA_PROP_END ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* if not found, add in dummy button */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( i  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemL ( row ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* next/prev button */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 09:33:44 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										BLI_snprintf ( numstr ,  sizeof ( numstr ) ,  " %d : " ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but =  uiDefIconTextButR_prop ( block ,  NUM ,  0 ,  0 ,  numstr ,  0 , 0 , UI_UNIT_X * 5 , UI_UNIT_Y ,  activeptr ,  activeprop ,  0 ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( i  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* default rows */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( rows  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											rows =  5 ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Change to the way brush/tool selection works, as discussed a while ago
Now, there are preset brushes made for each tool type (eg. for sculpt mode, Grab, 
Draw, Inflate, etc), and the recommended method for changing sculpt tools is to 
change between Brushes. The shortcut keys for changing between tools have 
now been changed to change between named brushes - the G key in sculpt 
mode now changes to any brush named 'Grab'.
The advantages of this are:
* Changing between brushes remembers the strength/size/texture etc settings for 
each brush. This means that for example, you can draw with a strong textured 
Clay brush, but then switch quickly to a weaker, untextured Smooth brush, 
without having to re-do your settings each time.
* You can now add your own custom shortcut keys to your own custom brushes - 
just add a keymap entry similar to the existing ones, that references your own 
custom brush names.
To bring over these new default brushes to an existing B.blend setup, just 
append them in from the new B.blend in svn.
											 
										 
										
											2009-12-28 01:27:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( maxrows  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											maxrows  =  5 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( pa - > list_grip_size  ! =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											rows =  pa - > list_grip_size ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* layout */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										box =  uiLayoutListBox ( layout ,  ptr ,  prop ,  activeptr ,  activeprop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										row =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										col  =  uiLayoutColumn ( row ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* init numbers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_property_int_range ( activeptr ,  activeprop ,  & min ,  & max ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-16 21:05:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( prop ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											len =  RNA_property_collection_length ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Change to the way brush/tool selection works, as discussed a while ago
Now, there are preset brushes made for each tool type (eg. for sculpt mode, Grab, 
Draw, Inflate, etc), and the recommended method for changing sculpt tools is to 
change between Brushes. The shortcut keys for changing between tools have 
now been changed to change between named brushes - the G key in sculpt 
mode now changes to any brush named 'Grab'.
The advantages of this are:
* Changing between brushes remembers the strength/size/texture etc settings for 
each brush. This means that for example, you can draw with a strong textured 
Clay brush, but then switch quickly to a weaker, untextured Smooth brush, 
without having to re-do your settings each time.
* You can now add your own custom shortcut keys to your own custom brushes - 
just add a keymap entry similar to the existing ones, that references your own 
custom brush names.
To bring over these new default brushes to an existing B.blend setup, just 
append them in from the new B.blend in svn.
											 
										 
										
											2009-12-28 01:27:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										items =  CLAMPIS ( len ,  rows ,  MAX2 ( rows ,  maxrows ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* if list length changes and active is out of view, scroll to it */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( pa - > list_last_len  ! =  len ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( ( activei  <  pa - > list_scroll  | |  activei  > =  pa - > list_scroll + items ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												pa - > list_scroll =  activei ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										pa - > list_scroll =  MIN2 ( pa - > list_scroll ,  len - items ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pa - > list_scroll =  MAX2 ( pa - > list_scroll ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										pa - > list_size =  items ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										pa - > list_last_len =  len ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 01:26:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ptr - > data  & &  prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* create list items */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_PROP_BEGIN ( ptr ,  itemptr ,  prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( i  > =  pa - > list_scroll  & &  i < pa - > list_scroll + items ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 13:09:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													list_item_row ( C ,  col ,  ptr ,  & itemptr ,  i ,  rnaicon ,  activeptr ,  activeprop ,  prop_list ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												i + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											RNA_PROP_END ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* add dummy buttons to fill space */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										while ( i  <  pa - > list_scroll + items )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( i  > =  pa - > list_scroll ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 18:03:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemL ( col ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											i + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* add scrollbar */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( len  >  items )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											col =  uiLayoutColumn ( row ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiDefButI ( block ,  SCROLL ,  0 ,  " " ,  0 , 0 , UI_UNIT_X * 0.75 , UI_UNIT_Y * items ,  & pa - > list_scroll ,  0 ,  len - items ,  items ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/************************* Operator Search Template **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  operator_call_cb ( bContext  * C ,  void  * UNUSED ( arg1 ) ,  void  * arg2 )  
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wmOperatorType  * ot =  arg2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										WM_operator_name_call ( C ,  ot - > idname ,  WM_OP_INVOKE_DEFAULT ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 09:45:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  operator_search_cb ( const  bContext  * C ,  void  * UNUSED ( arg ) ,  const  char  * str ,  uiSearchItems  * items )  
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-08-11 06:06:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									GHashIterator  * iter =  WM_operatortype_iter ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for (  ;  ! BLI_ghashIterator_isDone ( iter ) ;  BLI_ghashIterator_step ( iter ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										wmOperatorType  * ot =  BLI_ghashIterator_getValue ( iter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( BLI_strcasestr ( ot - > name ,  str ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-18 13:02:20 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if ( WM_operator_poll ( ( bContext * ) C ,  ot ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												char  name [ 256 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												int  len =  strlen ( ot - > name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* display name for menu, can hold hotkey */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 12:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												BLI_strncpy ( name ,  ot - > name ,  sizeof ( name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* check for hotkey */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 12:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( len  <  sizeof ( name ) - 6 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if  ( WM_key_event_operator_string ( C ,  ot - > idname ,  WM_OP_EXEC_DEFAULT ,  NULL ,  TRUE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													                                 & name [ len + 1 ] ,  sizeof ( name ) - len - 1 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														name [ len ] =  ' | ' ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 12:33:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( 0 = = uiSearchItemAdd ( items ,  name ,  ot ,  0 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-11 06:06:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									BLI_ghashIterator_free ( iter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateOperatorSearch ( uiLayout  * layout )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									static  char  search [ 256 ] =  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetCurLayout ( block ,  layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but =  uiDefSearchBut ( block ,  search ,  0 ,  ICON_VIEWZOOM ,  sizeof ( search ) ,  0 ,  0 ,  UI_UNIT_X * 6 ,  UI_UNIT_Y ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiButSetSearchFunc ( but ,  operator_search_cb ,  NULL ,  operator_call_cb ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/************************* Running Jobs Template **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_STOPRENDER	1 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_STOPCAST		2 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_STOPANIM		3 
  
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# define B_STOPCOMPO		4 
  
						 
					
						
							
								
									
										
											 
										
											
												== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
  additionally to the way, Blender 2.49 worked, you can select several
  strips at once and make Blender build proxies in the background (using
  the job system)
  Also a new thing: movie proxies are now build into AVI files, and
  the proxy system is moved into ImBuf-library, so that other parts
  of blender can also benefit from it.
  
* Timecode support: to fix seeking issues with files, that have
  a) varying frame rates
  b) very large GOP lengths
  c) are broken inbetween
  d) use different time code tracks
  
  the proxy builder can now also build timecode indices, which are
  used (optionally) for seeking.
  
  For the first time, it is possible, to do frame exact seeking on
  all file types.
  
* Support for different video-streams in one video file (can be
  selected in sequencer, other parts of blender can also use it,
  but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
  older versions don't support the pkt_pts field, that is essential
  for building timecode indices.
  
  Windows and Mac libs are already updated, Linux-users have to build
  their own ffmpeg verions until distros keep up.
											 
										 
										
											2011-08-28 14:46:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# define B_STOPSEQ		5 
  
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# define B_STOPCLIP		6 
  
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 02:40:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  do_running_jobs ( bContext  * C ,  void  * UNUSED ( arg ) ,  int  event )  
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  B_STOPRENDER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											G . afbreek =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  B_STOPCAST : 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 19:58:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											WM_jobs_stop ( CTX_wm_manager ( C ) ,  CTX_wm_screen ( C ) ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  B_STOPANIM : 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-16 20:37:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											WM_operator_name_call ( C ,  " SCREEN_OT_animation_play " ,  WM_OP_INVOKE_SCREEN ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  B_STOPCOMPO : 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-04 19:58:52 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											WM_jobs_stop ( CTX_wm_manager ( C ) ,  CTX_wm_area ( C ) ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
  additionally to the way, Blender 2.49 worked, you can select several
  strips at once and make Blender build proxies in the background (using
  the job system)
  Also a new thing: movie proxies are now build into AVI files, and
  the proxy system is moved into ImBuf-library, so that other parts
  of blender can also benefit from it.
  
* Timecode support: to fix seeking issues with files, that have
  a) varying frame rates
  b) very large GOP lengths
  c) are broken inbetween
  d) use different time code tracks
  
  the proxy builder can now also build timecode indices, which are
  used (optionally) for seeking.
  
  For the first time, it is possible, to do frame exact seeking on
  all file types.
  
* Support for different video-streams in one video file (can be
  selected in sequencer, other parts of blender can also use it,
  but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
  older versions don't support the pkt_pts field, that is essential
  for building timecode indices.
  
  Windows and Mac libs are already updated, Linux-users have to build
  their own ffmpeg verions until distros keep up.
											 
										 
										
											2011-08-28 14:46:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  B_STOPSEQ : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											WM_jobs_stop ( CTX_wm_manager ( C ) ,  CTX_wm_area ( C ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										case  B_STOPCLIP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											WM_jobs_stop ( CTX_wm_manager ( C ) ,  CTX_wm_area ( C ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateRunningJobs ( uiLayout  * layout ,  bContext  * C )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bScreen  * screen =  CTX_wm_screen ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wmWindowManager  * wm =  CTX_wm_manager ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ScrArea  * sa =  CTX_wm_area ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-17 17:06:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  * owner =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  handle_event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetCurLayout ( block ,  layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetHandleFunc ( block ,  do_running_jobs ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( sa - > spacetype = = SPACE_NODE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-17 17:06:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( WM_jobs_test ( wm ,  sa ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   owner  =  sa ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										handle_event =  B_STOPCOMPO ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
  additionally to the way, Blender 2.49 worked, you can select several
  strips at once and make Blender build proxies in the background (using
  the job system)
  Also a new thing: movie proxies are now build into AVI files, and
  the proxy system is moved into ImBuf-library, so that other parts
  of blender can also benefit from it.
  
* Timecode support: to fix seeking issues with files, that have
  a) varying frame rates
  b) very large GOP lengths
  c) are broken inbetween
  d) use different time code tracks
  
  the proxy builder can now also build timecode indices, which are
  used (optionally) for seeking.
  
  For the first time, it is possible, to do frame exact seeking on
  all file types.
  
* Support for different video-streams in one video file (can be
  selected in sequencer, other parts of blender can also use it,
  but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
  older versions don't support the pkt_pts field, that is essential
  for building timecode indices.
  
  Windows and Mac libs are already updated, Linux-users have to build
  their own ffmpeg verions until distros keep up.
											 
										 
										
											2011-08-28 14:46:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if  ( sa - > spacetype = = SPACE_SEQ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( WM_jobs_test ( wm ,  sa ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											owner  =  sa ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										handle_event  =  B_STOPSEQ ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-07 12:55:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  if ( sa - > spacetype = = SPACE_CLIP )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( WM_jobs_test ( wm ,  sa ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										   owner  =  sa ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										handle_event =  B_STOPCLIP ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												== Sequencer ==
This patch adds:
* support for proxy building again (missing feature from Blender 2.49)
  additionally to the way, Blender 2.49 worked, you can select several
  strips at once and make Blender build proxies in the background (using
  the job system)
  Also a new thing: movie proxies are now build into AVI files, and
  the proxy system is moved into ImBuf-library, so that other parts
  of blender can also benefit from it.
  
* Timecode support: to fix seeking issues with files, that have
  a) varying frame rates
  b) very large GOP lengths
  c) are broken inbetween
  d) use different time code tracks
  
  the proxy builder can now also build timecode indices, which are
  used (optionally) for seeking.
  
  For the first time, it is possible, to do frame exact seeking on
  all file types.
  
* Support for different video-streams in one video file (can be
  selected in sequencer, other parts of blender can also use it,
  but UI has to be added accordingly)
* IMPORTANT: this patch *requires* ffmpeg 0.7 or newer, since
  older versions don't support the pkt_pts field, that is essential
  for building timecode indices.
  
  Windows and Mac libs are already updated, Linux-users have to build
  their own ffmpeg verions until distros keep up.
											 
										 
										
											2011-08-28 14:46:03 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-12 03:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										Scene  * scene ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-17 17:06:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* another scene can be rendering too, for example via compositor */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for ( scene =  CTX_data_main ( C ) - > scene . first ;  scene ;  scene =  scene - > id . next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( WM_jobs_test ( wm ,  scene ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										owner  =  scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										handle_event =  B_STOPRENDER ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-17 17:06:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( owner )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 12:30:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiLayout  * ui_abs ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 12:30:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ui_abs =  uiLayoutAbsolute ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-28 02:34:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										( void ) ui_abs ;  // UNUSED
 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  BUT ,  handle_event ,  ICON_PANEL_CLOSE ,  
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												0 ,  UI_UNIT_Y * 0.1 ,  UI_UNIT_X * 0.8 ,  UI_UNIT_Y * 0.8 ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  TIP_ ( " Stop this job " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefBut ( block ,  PROGRESSBAR ,  0 ,  WM_jobs_name ( wm ,  owner ) ,  
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												UI_UNIT_X ,  0 ,  100 ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  WM_jobs_progress ( wm ,  owner ) ,  0 ,  TIP_ ( " Progress " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( WM_jobs_test ( wm ,  screen ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefIconTextBut ( block ,  BUT ,  B_STOPCAST ,  ICON_CANCEL ,  IFACE_ ( " Capture " ) ,  0 , 0 , 85 , UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TIP_ ( " Stop screencast " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( screen - > animtimer ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefIconTextBut ( block ,  BUT ,  B_STOPANIM ,  ICON_CANCEL ,  TIP_ ( " Anim Player " ) ,  0 , 0 , 100 , UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												TIP_ ( " Stop animation playback " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again). 
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
											 
										 
										
											2010-03-02 11:48:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/************************* Reports for Last Operator Template **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateReportsBanner ( uiLayout  * layout ,  bContext  * C )  
						 
					
						
							
								
									
										
											 
										
											
												Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again). 
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
											 
										 
										
											2010-03-02 11:48:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ReportList  * reports  =  CTX_wm_reports ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Report  * report =  BKE_reports_last_displayable ( reports ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ReportTimerInfo  * rti ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again). 
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
											 
										 
										
											2010-03-02 11:48:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 12:30:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * ui_abs ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-21 15:15:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiStyle  * style =  UI_GetStyle ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  width ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 12:02:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									int  icon = 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* if the report display has timed out, don't show */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! reports - > reporttimer )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rti =  ( ReportTimerInfo  * ) reports - > reporttimer - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2011-03-27 14:52:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! rti  | |  rti - > widthfac = = 0.0f  | |  ! report )  return ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 12:30:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui_abs =  uiLayoutAbsolute ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( ui_abs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									width  =  BLF_width ( style - > widget . uifont_id ,  report - > message ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									width  =  MIN2 ( rti - > widthfac * width ,  width ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									width  =  MAX2 ( width ,  10 ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again). 
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
											 
										 
										
											2010-03-02 11:48:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* make a box around the report to make it stand out */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but =  uiDefBut ( block ,  ROUNDBOX ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X + 10 ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-03 12:30:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* set the report's bg color in but->col - ROUNDBOX feature */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-19 10:04:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									rgb_float_to_uchar ( but - > col ,  rti - > col ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-13 13:53:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but - > col [ 3 ] =  255 ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but =  uiDefBut ( block ,  ROUNDBOX ,  0 ,  " " ,  UI_UNIT_X + 10 ,  0 ,  UI_UNIT_X + width ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-13 13:53:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but - > col [ 0 ] =  but - > col [ 1 ] =  but - > col [ 2 ] =  FTOCHAR ( rti - > greyscale ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but - > col [ 3 ] =  255 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* icon and report message on top */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( report - > type  &  RPT_ERROR_ALL ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 12:02:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon  =  ICON_ERROR ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( report - > type  &  RPT_WARNING_ALL ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 12:02:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon  =  ICON_ERROR ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( report - > type  &  RPT_INFO_ALL ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 12:02:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon  =  ICON_INFO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 *  to  be  shown  instead  of  icon  when  appropriate . . . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									 */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-24 19:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 12:02:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( reports - > list . first  ! =  reports - > list . last ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-20 20:38:26 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefIconButO ( block ,  BUT ,  " UI_OT_reports_to_textblock " ,  WM_OP_INVOKE_REGION_WIN ,  icon ,  2 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  TIP_ ( " Click to see rest of reports in textblock: 'Recent Reports' " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-17 12:02:36 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  LABEL ,  0 ,  icon ,  2 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-24 19:06:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefBut ( block ,  LABEL ,  0 ,  report - > message ,  UI_UNIT_X + 10 ,  0 ,  UI_UNIT_X + width ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												Info Header: Non-blocking Info Messages
Reports (i.e. 'info' or 'errors') are now shown in the info header in place of the scene statistics if the last executed operator had some, with this info disappearing again once another operator is run (to show scene statistics again). 
For example, this means that info such as the the number of verts merged, or whether a Keying Set successfully inserted keyframes, etc. is now shown again somewhere, and that this is done in a non-blocking manner.
The current implementation is still a bit crude (i.e. lacking fancy polish), but is at least barebones functional. The todos...
* When more than 1 report message is generated by the last operator, there is currently a display of the number of reports. In future, it would be nice to be able to add a button beside this or make the label clickable with appropriate text indicating this (commented out atm) to show popup menu of all the reports...
* There could probably be some kind of coloured backdrop behind the text. Currently using standard box, but that has padding problems, and lacks visual interest.
* Timer based fade out/disappear?
											 
										 
										
											2010-03-02 11:48:40 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 13:24:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************************* Keymap *************************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  keymap_item_modified ( bContext  * UNUSED ( C ) ,  void  * kmi_p ,  void  * UNUSED ( unused ) )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wmKeyMapItem  * kmi =  ( wmKeyMapItem * ) kmi_p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									WM_keyconfig_update_tag ( NULL ,  kmi ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  template_keymap_item_properties ( uiLayout  * layout ,  const  char  * title ,  PointerRNA  * ptr )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * flow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemS ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( title ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( layout ,  title ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									flow =  uiLayoutColumnFlow ( layout ,  2 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_STRUCT_BEGIN ( ptr ,  prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										int  flag =  RNA_property_flag ( prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( flag  &  PROP_HIDDEN ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* recurse for nested properties */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( RNA_property_type ( prop )  = =  PROP_POINTER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											PointerRNA  propptr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											const  char  * name =  RNA_property_ui_name ( prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( propptr . data  & &  RNA_struct_is_a ( propptr . type ,  & RNA_OperatorProperties ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												template_keymap_item_properties ( layout ,  name ,  & propptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* add property */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemR ( flow ,  ptr ,  RNA_property_identifier ( prop ) ,  0 ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_STRUCT_END ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateKeymapItemProperties ( uiLayout  * layout ,  PointerRNA  * ptr )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  propptr =  RNA_pointer_get ( ptr ,  " properties " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( propptr . data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBut  * but =  uiLayoutGetBlock ( layout ) - > buttons . last ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										template_keymap_item_properties ( layout ,  NULL ,  & propptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* attach callbacks to compensate for missing properties update,
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-03 16:31:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										 *  we  don ' t  know  which  keymap  ( item )  is  being  modified  there  */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 13:24:48 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										for ( ;  but ;  but = but - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( but ,  keymap_item_modified ,  ptr - > data ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}