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 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								/**
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  $ Id $ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 *  * * * * *  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  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# 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" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											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" 
  
						 
					
						
							
								
									
										
										
										
											2010-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_windowmanager_types.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-24 17:22: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 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# include  "BLI_string.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" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-24 17:22:22 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_icons.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-04-28 09:29:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_texture.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_utildefines.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "ED_screen.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" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# 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" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								void  ui_template_fix_linking ( )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************** 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-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************** DopeSheet Filter Template *************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateDopeSheetFilter ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Main  * mainptr =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ScrArea  * sa =  CTX_wm_area ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * row =  layout ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									short  nlaActive =  ( ( sa )  & &  ( sa - > spacetype = = SPACE_NLA ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-17 12:03:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* more 'generic' filtering options */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-17 12:03:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemR ( row ,  ptr ,  " only_selected " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemR ( row ,  ptr ,  " display_transforms " ,  0 ,  " " ,  0 ) ;  // xxx: include in another position instead?
 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-17 12:03:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( nlaActive ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " include_missing_nla " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-17 12:03:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* datatype based - only available datatypes are shown */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemR ( row ,  ptr ,  " display_scene " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemR ( row ,  ptr ,  " display_world " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemR ( row ,  ptr ,  " display_node " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-17 12:03:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 00:52:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > mesh . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_mesh " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > key . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_shapekeys " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > mat . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_material " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > lamp . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_lamp " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-17 10:21:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > tex . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_texture " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > camera . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_camera " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > curve . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_curve " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > mball . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_metaball " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > armature . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_armature " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > particle . first ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " display_particle " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-23 03:57:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* group-based filtering (only when groups are available */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( mainptr  & &  mainptr - > group . first )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  ptr ,  " only_group_objects " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-23 03:57:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* if enabled, show the group selection field too */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( RNA_boolean_get ( ptr ,  " only_group_objects " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemR ( row ,  ptr ,  " filtering_group " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-23 03:57:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 11:50:05 +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 ; 
							 
						 
					
						
							
								
									
										
										
										
											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 */  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  id_search_cb ( const  bContext  * C ,  void  * arg_template ,  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-03-16 17:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* hide dot-datablocks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-15 10:37:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												iconid =  ui_id_icon_get ( ( bContext * ) C ,  id ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-16 17:23:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 08:27:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if ( ! uiSearchItemAdd ( items ,  id - > name + 2 ,  id ,  iconid ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									wmEvent  event ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but =  uiDefSearchBut ( block ,  search ,  0 ,  ICON_VIEWZOOM ,  256 ,  10 ,  0 ,  w ,  19 ,  template . prv_rows ,  template . prv_cols ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but =  uiDefSearchBut ( block ,  search ,  0 ,  ICON_VIEWZOOM ,  256 ,  10 ,  0 ,  150 ,  19 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									event =  * ( win - > eventstate ) ; 	/* XXX huh huh? make api call */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									event . type =  EVT_BUT_OPEN ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									event . val =  KM_PRESS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									event . customdata =  but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									event . customdatafree =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wm_event_add ( win ,  & event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * id =  idptr . data ,  * newid ; 
							 
						 
					
						
							
								
									
										
										
										
											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 : 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											printf ( " warning, id event %d shouldnt come here \n " ,  event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( id - > flag  &  LIB_FAKEUSER )  id - > us + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												else  id - > us - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* make copy */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( id_copy ( id ,  & newid ,  0 )  & &  newid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* us is 1 by convention, but RNA_property_pointer_set
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													   will  also  incremement  it ,  so  set  it  to  zero  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													newid - > us =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													/* assign copy */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													RNA_id_pointer_create ( newid ,  & idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													RNA_property_pointer_set ( & template - > ptr ,  template - > prop ,  idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													RNA_property_update ( C ,  & template - > ptr ,  template - > prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  template_ID ( bContext  * C ,  uiLayout  * layout ,  TemplateID  * template ,  StructRNA  * type ,  int  flag ,  char  * newop ,  char  * openop ,  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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ListBase  * lb ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ID  * id ,  * idfrom ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but =  uiDefBlockButN ( block ,  id_search_menu ,  MEM_dupallocN ( template ) ,  " " ,  0 ,  0 ,  UI_UNIT_X * 6 ,  UI_UNIT_Y * 6 ,  " Browse ID data " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-07-09 19:45:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( flag  &  UI_ID_BROWSE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 09:59:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but =  uiDefBlockButN ( block ,  id_search_menu ,  MEM_dupallocN ( template ) ,  " " ,  0 ,  0 ,  UI_UNIT_X * 1.6 ,  UI_UNIT_Y ,  " Browse ID data " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 ] ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( id - > lib )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( id - > flag  &  LIB_INDIRECT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_LIBRARY_DATA_INDIRECT ,  0 , 0 , UI_UNIT_X , UI_UNIT_Y ,  0 ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													" Indirect library datablock, cannot change. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_LIBRARY_DATA_DIRECT ,  0 , 0 , UI_UNIT_X , UI_UNIT_Y ,  0 ,  0 ,  0 ,  0 ,  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													" Direct linked library datablock, click to make local. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											char  str [ 32 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											sprintf ( str ,  " %d " ,  id - > us ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( id - > us < 10 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but =  uiDefBut ( block ,  BUT ,  0 ,  str ,  0 , 0 , UI_UNIT_X , UI_UNIT_Y ,  0 ,  0 ,  0 ,  0 ,  0 ,  " Displays number of users of this data. Click to make a single-user copy. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												but =  uiDefBut ( block ,  BUT ,  0 ,  str ,  0 , 0 , UI_UNIT_X + 10 , UI_UNIT_Y ,  0 ,  0 ,  0 ,  0 ,  0 ,  " Displays number of users of this data. Click to make a single-user copy. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_ALONE ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( ! id_copy ( id ,  NULL ,  1  /* test only */ )  | |  ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											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 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-15 17:14:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextButO ( block ,  BUT ,  newop ,  WM_OP_INVOKE_DEFAULT ,  ICON_ZOOMIN ,  ( id ) ?  " " :  " 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  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextBut ( block ,  BUT ,  0 ,  ICON_ZOOMIN ,  ( id ) ?  " " :  " 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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconTextButO ( block ,  BUT ,  openop ,  WM_OP_INVOKE_DEFAULT ,  ICON_FILESEL ,  ( id ) ?  " " :  " 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  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											but =  uiDefIconTextBut ( block ,  BUT ,  0 ,  ICON_FILESEL ,  ( id ) ?  " " :  " Open " ,  0 ,  0 ,  w ,  UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetNFunc ( but ,  template_id_cb ,  MEM_dupallocN ( template ) ,  SET_INT_IN_POINTER ( UI_ID_OPEN ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* delete button */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-04 21:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( id  & &  ( flag  &  UI_ID_DELETE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-11 17:21:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-23 15:34:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											but =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_X ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ,  0 ,  0 ,  0 ,  0 ,  " Unlink datablock, Shift + Click to force removal on save " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ( idfrom  & &  idfrom - > lib ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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-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-01-13 06:35:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  ui_template_id ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  char  * newop ,  char  * openop ,  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 ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateID: pointer property not found: %s \n " ,  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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											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-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 13:20:41 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									type =  RNA_property_pointer_type ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
										
											
												* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
  by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
  Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
  /usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
  by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
  bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
											 
										 
										
											2010-03-30 12:15:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									template - > idlb =  which_libbase ( CTX_data_main ( C ) ,  RNA_type_to_ID_code ( type ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										template_ID ( C ,  layout ,  template ,  type ,  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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateID ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  char  * newop ,  char  * openop ,  char  * unlinkop )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-01-13 06:35:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									ui_template_id ( layout ,  C ,  ptr ,  propname ,  newop ,  openop ,  unlinkop ,  UI_ID_BROWSE | UI_ID_RENAME | UI_ID_DELETE ,  0 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateIDBrowse ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  char  * newop ,  char  * openop ,  char  * unlinkop )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateIDPreview ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  char  * newop ,  char  * openop ,  char  * unlinkop ,  int  rows ,  int  cols )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2010-01-13 06:35:12 +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 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateAnyID ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  char  * proptypename ,  char  * text )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateAnyID: pointer property not found: %s \n " ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! propType  | |  RNA_property_type ( propType )  ! =  PROP_ENUM )  {  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateAnyID: pointer-type property not found: %s \n " ,  proptypename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( row ,  text ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( row ,  " ID-Block: " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* 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
 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemFullR ( row ,  ptr ,  propType ,  0 ,  0 ,  UI_ITEM_R_ICON_ONLY ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-14 09:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* ID-Block Selector - just use pointer widget... */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemFullR ( row ,  ptr ,  propID ,  0 ,  0 ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplatePathBuilder ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  PointerRNA  * root_ptr ,  char  * text )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * propPath ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiLayout  * row ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* check that properties are valid */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									propPath =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! propPath  | |  RNA_property_type ( propPath )  ! =  PROP_STRING )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplatePathBuilder: path property not found: %s \n " ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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_DerivedMesh.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_global.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_modifier.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_object.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_particle.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# include  "BKE_report.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 ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
  NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
  notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
  should only be used for notifying about changes in space data,
  we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
											 
										 
										
											2009-09-04 20:51:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_id_flush_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 ) ; 
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
  NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
  notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
  should only be used for notifying about changes in space data,
  we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
											 
										 
										
											2009-09-04 20:51:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									DAG_id_flush_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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									// fluid particle modifier can't be deleted here
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  uiLayout  * draw_modifier ( uiLayout  * layout ,  Scene  * scene ,  Object  * ob ,  ModifierData  * md ,  int  index ,  int  cageIndex ,  int  lastCageIndex ,  int  compact )  
						 
					
						
							
								
									
										
										
										
											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-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * box ,  * column ,  * row ,  * col ; 
							 
						 
					
						
							
								
									
										
										
										
											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
 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-21 15:34:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										sprintf ( 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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										but  =  uiDefBut ( block ,  BUT ,  0 ,  " Make Real " ,  0 ,  0 ,  80 ,  16 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " 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-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiLayout  * split ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										split  =  uiLayoutSplit ( box ,  0.16 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										col =  uiLayoutColumn ( split ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										row  =  uiLayoutRow ( col ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 .................................  */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " expanded " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* modifier-type icon */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemL ( row ,  " " ,  RNA_struct_ui_icon ( ptr . type ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* 'Middle Column' ............................ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	-  first  row  is  the  name  of  the  modifier  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 * 	-  second  row  is  the  visibility  settings ,  since  the  layouts  were  not  wide  enough  to  show  all 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										 */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										col =  uiLayoutColumn ( split ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										row =  uiLayoutRow ( col ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutSetAlignment ( row ,  UI_LAYOUT_ALIGN_EXPAND ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										block  =  uiLayoutGetBlock ( row ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* modifier name */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " name " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( compact )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* insert delete button at end of top row before splitting to second line */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( modifier_can_delete ( md ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiItemO ( row ,  " " ,  ICON_X ,  " OBJECT_OT_modifier_remove " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											split  =  uiLayoutSplit ( box ,  0.17 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											col =  uiLayoutColumn ( split ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemL ( col ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											col =  uiLayoutColumn ( split ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											row  =  uiLayoutRow ( col ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* 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 )  )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemR ( row ,  & ptr ,  " render " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemR ( row ,  & ptr ,  " realtime " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-29 10:25:14 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											if  ( mti - > flags  &  eModifierTypeFlag_SupportsEditmode ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemR ( row ,  & ptr ,  " editmode " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if  ( ( ob - > type = = OB_MESH )  & &  modifier_couldBeCage ( scene ,  md )  & &  ( index  < =  lastCageIndex ) )  
							 
						 
					
						
							
								
									
										
										
										
											2010-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* -- convert to rna ? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											but  =  uiDefIconButBitI ( block ,  TOG ,  eModifierMode_OnCage ,  0 ,  ICON_MESH_DATA ,  0 ,  0 ,  16 ,  20 ,  & md - > mode ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Apply modifier to editing cage during Editmode " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( index  <  cageIndex ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiButSetFlag ( but ,  UI_BUT_DISABLED ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( but ,  modifiers_setOnCage ,  ob ,  md ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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-01-20 05:41:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ! compact )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( modifier_can_delete ( md ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiItemO ( row ,  " " ,  ICON_X ,  " OBJECT_OT_modifier_remove " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														uiItemO ( row ,  " Convert " ,  0 ,  " OBJECT_OT_duplicates_make_real " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													else  if ( psys - > part - > ren_as  = =  PART_DRAW_PATH ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														uiItemO ( row ,  " Convert " ,  0 ,  " 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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:25:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemEnumO ( row ,  " OBJECT_OT_modifier_apply " ,  " Apply " ,  0 ,  " apply_as " ,  MODIFIER_APPLY_DATA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 18:17:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if  ( modifier_sameTopology ( md ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:25:33 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uiItemEnumO ( row ,  " OBJECT_OT_modifier_apply " ,  " Apply as Shape " ,  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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if  ( ! ELEM4 ( md - > type ,  eModifierType_Fluidsim ,  eModifierType_Softbody ,  eModifierType_ParticleSystem ,  eModifierType_Cloth ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-02 19:41:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemO ( row ,  " Copy " ,  0 ,  " 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-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								uiLayout  * uiTemplateModifier ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  int  compact )  
						 
					
						
							
								
									
										
										
										
											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 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateModifier: expected modifier on object. \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob =  ptr - > id . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									md =  ptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! ob  | |  ! ( GS ( ob - > id . name )  = =  ID_OB ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateModifier: expected modifier on object. \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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-01-25 11:39:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											return  draw_modifier ( layout ,  scene ,  ob ,  md ,  i ,  cageIndex ,  lastCageIndex ,  compact ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  do_constraint_panels ( bContext  * C ,  void  * arg ,  int  event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob =  CTX_data_active_object ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  B_CONSTRAINT_TEST : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// XXX allqueue(REDRAWVIEW3D, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// XXX allqueue(REDRAWBUTSOBJECT, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										// XXX allqueue(REDRAWBUTSEDIT, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										break ;   // no handling
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									case  B_CONSTRAINT_CHANGETARGET : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( ob - > pose )  ob - > pose - > flag  | =  POSE_RECALC ; 	// checks & sorts pose channels
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										DAG_scene_sort ( scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										
											
												2.5
Notifiers
---------
Various fixes for wrong use of notifiers, and some new notifiers
to make things a bit more clear and consistent, with two notable
changes:
* Geometry changes are now done with NC_GEOM, rather than
  NC_OBJECT|ND_GEOM_, so an object does need to be available.
* Space data now use NC_SPACE|ND_SPACE_*, instead of data
  notifiers or even NC_WINDOW in some cases. Note that NC_SPACE
  should only be used for notifying about changes in space data,
  we don't want to go back to allqueue(REDRAW..).
Depsgraph
---------
The dependency graph now has a different flush call:
DAG_object_flush_update(scene, ob, flag)
is replaced by:
DAG_id_flush_update(id, flag)
It still works basically the same, one difference is that it now
also accepts object data (e.g. Mesh), again to avoid requiring an
Object to be available. Other ID types will simply do nothing at
the moment.
Docs
----
I made some guidelines for how/when to do which kinds of updates
and notifiers. I can't specify totally exact how to make these
decisions, but these are basically the guidelines I use. So, new
and updated docs are here:
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/NotifiersUpdates
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/DataNotifiers
											 
										 
										
											2009-09-04 20:51:09 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( ob - > type = = OB_ARMATURE )  DAG_id_flush_update ( & ob - > id ,  OB_RECALC_DATA | OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  DAG_id_flush_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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// XXX allqueue(REDRAWVIEW3D, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// XXX allqueue(REDRAWBUTSOBJECT, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									// XXX allqueue(REDRAWBUTSEDIT, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  constraint_active_func ( bContext  * C ,  void  * ob_v ,  void  * con_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_object_constraint_set_active ( ob_v ,  con_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* draw panel showing settings for a constraint */  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  uiLayout  * draw_constraint ( uiLayout  * layout ,  Object  * ob ,  bConstraint  * con )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bPoseChannel  * pchan =  get_active_posechannel ( ob ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bConstraintTypeInfo  * cti ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * result =  NULL ,  * col ,  * box ,  * row ,  * subrow ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  typestr [ 32 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									short  width  =  265 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									short  proxy_protected ,  xco = 0 ,  yco = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  rb_col ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* get constraint typeinfo */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									cti =  constraint_get_typeinfo ( con ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( cti  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										/* exception for 'Null' constraint - it doesn't have constraint typeinfo! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( con - > type  = =  CONSTRAINT_TYPE_NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											strcpy ( typestr ,  " Null " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											strcpy ( typestr ,  " Unknown " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										strcpy ( typestr ,  cti - > name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* 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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetHandleFunc ( block ,  do_constraint_panels ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									row =  uiLayoutRow ( box ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( box ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									subrow =  uiLayoutRow ( row ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-09 08:33:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									//uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* Draw constraint header */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSSN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* rounded header */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rb_col =  ( con - > flag  &  CONSTRAINT_ACTIVE ) ? 50 : 20 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* open/close */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemR ( subrow ,  & ptr ,  " expanded " ,  UI_ITEM_R_ICON_ONLY ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* name */ 	
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* XXX if (con->flag & CONSTRAINT_DISABLE)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiBlockSetCol ( block ,  TH_REDALERT ) ; */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefBut ( block ,  LABEL ,  B_CONSTRAINT_TEST ,  typestr ,  xco + 10 ,  yco ,  100 ,  18 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( proxy_protected  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( subrow ,  & ptr ,  " name " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-10 13:56:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-28 23:41:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemL ( subrow ,  con - > name ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									subrow =  uiLayoutRow ( row ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-09 08:33:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									//uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
 
							 
						 
					
						
							
								
									
										
										
										
											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" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  BUT ,  B_CONSTRAINT_TEST ,  ICON_GHOST ,  xco + 244 ,  yco ,  19 ,  19 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Proxy Protected " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  BUT ,  B_CONSTRAINT_TEST ,  ICON_LOCKED ,  xco + 262 ,  yco ,  19 ,  19 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Proxy Protected " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if  ( show_upbut  | |  show_downbut )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2009-07-11 12:54:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( show_upbut ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-12 17:00:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uiDefIconButO ( block ,  BUT ,  " CONSTRAINT_OT_move_up " ,  WM_OP_INVOKE_DEFAULT ,  ICON_TRIA_UP ,  xco + width - 50 ,  yco ,  16 ,  18 ,  " Move constraint up in constraint stack " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2009-07-11 12:54:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												if  ( show_downbut ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-12 17:00:38 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uiDefIconButO ( block ,  BUT ,  " CONSTRAINT_OT_move_down " ,  WM_OP_INVOKE_DEFAULT ,  ICON_TRIA_DOWN ,  xco + width - 50 + 18 ,  yco ,  16 ,  18 ,  " Move constraint down in constraint stack " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-24 21:22:24 +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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-24 21:22:24 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiDefIconButBitS ( block ,  ICONTOGN ,  CONSTRAINT_OFF ,  B_CONSTRAINT_TEST ,  ICON_CHECKBOX_DEHLT ,  xco + 243 ,  yco ,  19 ,  19 ,  & con - > flag ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " enable/disable constraint " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-25 01:30:32 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2009-07-11 12:54:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiDefIconButO ( block ,  BUT ,  " CONSTRAINT_OT_delete " ,  WM_OP_INVOKE_DEFAULT ,  ICON_X ,  xco + 262 ,  yco ,  19 ,  19 ,  " Delete constraint " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* 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 */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-09 08:33:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									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 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-27 00:03:49 +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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								uiLayout  * uiTemplateConstraint ( uiLayout  * layout ,  PointerRNA  * ptr )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bConstraint  * con ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* verify we have valid data */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! RNA_struct_is_a ( ptr - > type ,  & RNA_Constraint ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateConstraint: expected constraint on object. \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ob =  ptr - > id . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									con =  ptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! ob  | |  ! ( GS ( ob - > id . name )  = =  ID_OB ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateConstraint: expected constraint on object. \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  draw_constraint ( layout ,  ob ,  con ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											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" 
  
						 
					
						
							
								
									
										
										
										
											2010-04-04 12:09:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "DNA_texture_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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-18 19:58:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplatePreview ( uiLayout  * layout ,  ID  * id ,  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 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-07 11:42:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										printf ( " uiTemplatePreview: expected ID of type material, texture, lamp or world. \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 13:20:35 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( pid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiItemR ( col ,  & material_ptr ,  " preview_render_type " ,  UI_ITEM_R_EXPAND ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:57:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiDefButS ( block ,  ROW ,  B_MATPRV ,  " Texture " ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_TEXTURE ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( GS ( parent - > name )  = =  ID_MA ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiDefButS ( block ,  ROW ,  B_MATPRV ,  " Material " ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_OTHER ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  if ( GS ( parent - > name )  = =  ID_LA ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiDefButS ( block ,  ROW ,  B_MATPRV ,  " Lamp " ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_OTHER ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  if ( GS ( parent - > name )  = =  ID_WO ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiDefButS ( block ,  ROW ,  B_MATPRV ,  " World " ,   0 ,  0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  pr_texture ,  10 ,  TEX_PR_OTHER ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiDefButS ( block ,  ROW ,  B_MATPRV ,  " 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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											/* Alpha buton for texture preview */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( * pr_texture ! = TEX_PR_OTHER )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												row  =  uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												uiItemR ( row ,  & texture_ptr ,  " use_preview_alpha " ,  0 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_texture.h" 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								typedef  struct  RNAUpdateCb  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  RNAUpdateCb ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  rna_update_cb ( bContext  * C ,  void  * arg_cb ,  void  * arg_unused )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNAUpdateCb  * cb =  ( RNAUpdateCb * ) arg_cb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* we call update here on the pointer property, this way the
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									   owner  of  the  curve  mapping  can  still  define  it ' s  own  update 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									   and  notifier ,  even  if  the  CurveMapping  struct  is  shared .  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									RNA_property_update ( C ,  & cb - > ptr ,  cb - > prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								# define B_BANDCOL 1 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  int  vergcband ( const  void  * a1 ,  const  void  * a2 )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									const  CBData  * x1 = a1 ,  * x2 = a2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if (  x1 - > pos  >  x2 - > pos  )  return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if (  x1 - > pos  <  x2 - > pos )  return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  colorband_pos_cb ( bContext  * C ,  void  * cb_v ,  void  * coba_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ColorBand  * coba =  coba_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( coba - > tot < 2 )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( a = 0 ;  a < coba - > tot ;  a + + )  coba - > data [ a ] . cur =  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									qsort ( coba - > data ,  coba - > tot ,  sizeof ( CBData ) ,  vergcband ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( a = 0 ;  a < coba - > tot ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( coba - > data [ a ] . cur = = coba - > cur )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											coba - > cur =  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								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-04-28 09:29:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( coba - > tot  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										CBData  * xnew ,  * x1 ,  * x2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										float  col [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										xnew =  & coba - > data [ coba - > tot ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( coba - > tot  >  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( coba - > cur  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												x1 =  & coba - > data [ coba - > cur - 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												x2 =  & coba - > data [ coba - > cur ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												x1 =  & coba - > data [ coba - > cur ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												x2 =  & coba - > data [ coba - > cur + 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											xnew - > pos  =  x1 - > pos  +  ( ( x2 - > pos  -  x1 - > pos )  /  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										do_colorband ( coba ,  xnew - > pos ,  col ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										xnew - > r =  col [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										xnew - > g =  col [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										xnew - > b =  col [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										xnew - > a =  col [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( coba - > tot  <  MAXCOLORBAND - 1 )  coba - > tot + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									coba - > cur =  coba - > tot - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									colorband_pos_cb ( C ,  cb_v ,  coba_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_undo_push ( C ,  " Add colorband " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  colorband_del_cb ( bContext  * C ,  void  * cb_v ,  void  * coba_v )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ColorBand  * coba =  coba_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( coba - > tot < 2 )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( a = coba - > cur ;  a < coba - > tot ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										coba - > data [ a ] =  coba - > data [ a + 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( coba - > cur )  coba - > cur - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									coba - > tot - - ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									ED_undo_push ( C ,  " Delete colorband " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rna_update_cb ( C ,  cb_v ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/* 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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiBut  * bt ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-12 12:08:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * row ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( coba = = NULL )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	" Add " , 			0 + xoffs , 100 + yoffs , 50 , 20 ,  0 ,  0 ,  0 ,  0 ,  0 ,  " Add a new color stop to the colorband " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_add_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	" Delete " , 		60 + xoffs , 100 + yoffs , 50 , 20 ,  0 ,  0 ,  0 ,  0 ,  0 ,  " Delete the active position " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_del_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefButS ( block ,  NUM ,  0 , 		" " , 				120 + xoffs , 100 + yoffs , 80 ,  20 ,  & coba - > cur ,  0.0 ,  ( float ) ( MAX2 ( 0 ,  coba - > tot - 1 ) ) ,  0 ,  0 ,  " Choose active color stop " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefButS ( block ,  MENU ,  0 , 		" Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4 " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											210 + xoffs ,  100 + yoffs ,  90 ,  20 , 		& coba - > ipotype ,  0.0 ,  0.0 ,  0 ,  0 ,  " Set interpolation between color stops " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT_COLORBAND ,  0 ,  " " ,  	xoffs , 65 + yoffs , 300 , 30 ,  coba ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " position " ,  0 ,  " Pos " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemR ( row ,  & ptr ,  " color " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	" Add " , 			xs , butr - > ymin + 20.0f , 2.0f * unit , 20 , 	NULL ,  0 ,  0 ,  0 ,  0 ,  " Add a new color stop to the colorband " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_add_cb ,  MEM_dupallocN ( cb ) ,  coba ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT ,  0 , 	" Delete " , 		xs + 2.0f * unit , butr - > ymin + 20.0f , 2.0f * unit , 20 , 	NULL ,  0 ,  0 ,  0 ,  0 ,  " Delete the active position " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  colorband_del_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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( layout ,  & ptr ,  " color " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 10:57:46 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefButS ( block ,  MENU ,  0 , 		" Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4 " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											xs + 10.0f * unit ,  butr - > ymin + 20.0f ,  unit * 4 ,  20 , 		& coba - > ipotype ,  0.0 ,  0.0 ,  0 ,  0 ,  " Set interpolation between color stops " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  BUT_COLORBAND ,  0 ,  " " , 		xs , butr - > ymin , butr - > xmax - butr - > xmin , 20.0f ,  coba ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateColorRamp ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname ,  int  expand )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateHistogram ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname ,  int  expand )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									hist - > height =  ( hist - > height < = 0 ) ? 100 : hist - > height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateWaveform ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname ,  int  expand )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scopes - > wavefrm_height =  ( scopes - > wavefrm_height < = 0 ) ? 100 : scopes - > wavefrm_height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefBut ( block ,  WAVEFORM ,  0 ,  " " ,  rect . xmin ,  rect . ymin ,  rect . xmax - rect . xmin ,  scopes - > wavefrm_height ,  scopes ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									MEM_freeN ( cb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								/********************* Vectorscope Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateVectorscope ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname ,  int  expand )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									scopes - > vecscope_height =  ( scopes - > vecscope_height < = 0 ) ? 100 : 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 ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								# include  "BKE_colortools.h" 
  
						 
					
						
							
								
									
										
										
										
											2009-06-03 00:14:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_zoom_in ( bContext  * C ,  void  * cumap_v ,  void  * unused )  
						 
					
						
							
								
									
										
										
										
											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 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  curvemap_buttons_zoom_out ( bContext  * C ,  void  * cumap_v ,  void  * unused )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									CurveMapping  * cumap  =  cumap_v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  d ,  d1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* we allow 20 times zoom, but dont view outside clip */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  curvemap_buttons_setclip ( bContext  * C ,  void  * cumap_v ,  void  * unused )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiBeginBlock ( C ,  ar ,  " curvemap_clipping_func " ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* use this for a fake extra empy space around the buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefBut ( block ,  LABEL ,  0 ,  " " , 			- 4 ,  16 ,  128 ,  106 ,  NULL ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefButBitI ( block ,  TOG ,  CUMA_DO_CLIP ,  1 ,  " Use Clipping " , 	 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											0 , 100 , 120 , 18 ,  & cumap - > flag ,  0.0 ,  0.0 ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetFunc ( bt ,  curvemap_buttons_setclip ,  cumap ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockBeginAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  " Min X  " , 	 0 , 74 , 120 , 18 ,  & cumap - > clipr . xmin ,  - 100.0 ,  cumap - > clipr . xmax ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  " Min Y  " , 	 0 , 56 , 120 , 18 ,  & cumap - > clipr . ymin ,  - 100.0 ,  cumap - > clipr . ymax ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  " Max X  " , 	 0 , 38 , 120 , 18 ,  & cumap - > clipr . xmax ,  cumap - > clipr . xmin ,  100.0 ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefButF ( block ,  NUM ,  0 ,  " Max Y  " , 	 0 , 20 , 120 , 18 ,  & cumap - > clipr . ymax ,  cumap - > clipr . ymin ,  100.0 ,  10 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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-03-09 07:41:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											curvemap_reset ( cuma ,  & cumap - > clipr , 	cumap - > preset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									short  yco =  0 ,  menuwidth = 120 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiBeginBlock ( C ,  ar ,  " curvemap_tools_func " ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetButmFunc ( block ,  curvemap_tools_dofunc ,  cumap_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Reset View " , 				0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  1 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Vector Handle " , 			0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  2 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Auto Handle " , 			0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  3 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Extend Horizontal " , 		0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  4 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Extend Extrapolated " , 	0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  5 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Reset Curve " , 			0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									short  yco =  0 ,  menuwidth = 120 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiBeginBlock ( C ,  ar ,  " curvemap_tools_func " ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetButmFunc ( block ,  curvemap_tools_dofunc ,  cumap_v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Reset View " , 				0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  1 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Vector Handle " , 			0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  2 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Auto Handle " , 			0 ,  yco - = 20 ,  menuwidth ,  19 ,  NULL ,  0.0 ,  0.0 ,  0 ,  3 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 07:41:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefIconTextBut ( block ,  BUTM ,  1 ,  ICON_BLANK1 ,  " Reset Curve " , 			0 ,  yco - = 20 ,  menuwidth ,  19 ,  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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  curvemap_buttons_redraw ( bContext  * C ,  void  * arg1 ,  void  * arg2 )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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-03-09 07:41:27 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										curvemap_reset ( cumap - > cm + a ,  & cumap - > clipr ,  cumap - > preset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " X " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " Y " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  1.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 2 ] . curve )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " Z " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  2.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " C " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  3.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 0 ] . curve )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " R " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 1 ] . curve )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " G " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  1.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 2 ] . curve )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " B " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  2.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " H " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 1 ] . curve )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " S " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  1.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiButSetFunc ( bt ,  curvemap_buttons_redraw ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( cumap - > cm [ 2 ] . curve )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											bt =  uiDefButI ( block ,  ROW ,  0 ,  " V " ,  0 ,  0 ,  dx ,  16 ,  & cumap - > cur ,  0.0 ,  2.0 ,  0.0 ,  0.0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_ZOOMIN ,  0 ,  0 ,  dx ,  14 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Zoom in " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetFunc ( bt ,  curvemap_buttons_zoom_in ,  cumap ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_ZOOMOUT ,  0 ,  0 ,  dx ,  14 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Zoom out " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetFunc ( bt ,  curvemap_buttons_zoom_out ,  cumap ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if ( brush ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bt =  uiDefIconBlockBut ( block ,  curvemap_brush_tools_func ,  cumap ,  0 ,  ICON_MODIFIER ,  0 ,  0 ,  dx ,  18 ,  " Tools " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bt =  uiDefIconBlockBut ( block ,  curvemap_tools_func ,  cumap ,  0 ,  ICON_MODIFIER ,  0 ,  0 ,  dx ,  18 ,  " Tools " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefIconBlockBut ( block ,  curvemap_clipping_func ,  cumap ,  0 ,  icon ,  0 ,  0 ,  dx ,  18 ,  " Clipping Options " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetNFunc ( bt ,  rna_update_cb ,  MEM_dupallocN ( cb ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bt =  uiDefIconBut ( block ,  BUT ,  0 ,  ICON_X ,  0 ,  0 ,  dx ,  18 ,  NULL ,  0.0 ,  0.0 ,  0.0 ,  0.0 ,  " Delete points " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiItemR ( uiLayoutColumn ( split ,  0 ) ,  ptr ,  " black_level " ,  UI_ITEM_R_EXPAND ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiItemR ( uiLayoutColumn ( split ,  0 ) ,  ptr ,  " white_level " ,  UI_ITEM_R_EXPAND ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayoutRow ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										bt = uiDefBut ( block ,  BUT ,  0 ,  " Reset " , 	0 ,  0 ,  UI_UNIT_X * 10 ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " Reset Black/White point and curves " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiButSetNFunc ( bt ,  curvemap_buttons_reset ,  MEM_dupallocN ( cb ) ,  cumap ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockSetNFunc ( block ,  NULL ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-04 17:28:37 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateCurveMapping ( uiLayout  * layout ,  PointerRNA  * ptr ,  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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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_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-01-27 00:22:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateColorWheel ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname ,  int  value_slider ,  int  lock )  
						 
					
						
							
								
									
										
										
										
											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-01-27 00:22:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									float  softmin ,  softmax ,  step ,  precision ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateColorWheel: property not found: %s \n " ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-01-27 00:22:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiDefButR ( block ,  HSVCIRCLE ,  0 ,  " " , 	0 ,  0 ,  WHEEL_SIZE ,  WHEEL_SIZE ,  ptr ,  propname ,  - 1 ,  0.0 ,  0.0 ,  0 ,  lock ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemS ( row ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( value_slider ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-27 00:22:29 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiDefButR ( block ,  HSVCUBE ,  0 ,  " " ,  WHEEL_SIZE + 6 ,  0 ,  14 ,  WHEEL_SIZE ,  ptr ,  propname ,  - 1 ,  softmin ,  softmax ,  9 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-07 09:55:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								/********************* TriColor (ThemeWireColorSet) Template ************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateTriColorSet ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									PropertyRNA  * prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * row ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									PointerRNA  csPtr ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 18:47:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									if  ( ! prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateTriColorSet: property not found: %s \n " ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* we lay out the data in a row as 3 color swatches */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									row =  uiLayoutRow ( layout ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* nselected, selected, active color swatches */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									csPtr =  RNA_property_pointer_get ( ptr ,  prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiItemR ( row ,  & csPtr ,  " normal " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemR ( row ,  & csPtr ,  " selected " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiItemR ( row ,  & csPtr ,  " active " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-21 12:38:01 +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 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										RNA_property_boolean_set_index ( & but - > rnapoin ,  but - > rnaprop ,  cur ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										for ( i  =  0 ;  i  <  tot ;  + + i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											if ( i  ! =  cur ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												RNA_property_boolean_set_index ( & but - > rnapoin ,  but - > rnaprop ,  i ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											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
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 02:42:47 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateLayers ( uiLayout  * layout ,  PointerRNA  * ptr ,  char  * propname ,  
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											  PointerRNA  * used_ptr ,  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 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									const  char  * desc ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									prop =  RNA_struct_find_property ( ptr ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateLayer: layers property not found: %s \n " ,  propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									desc =  RNA_property_description ( prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 11:21:02 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* 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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											printf ( " uiTemplateLayer: used layers property not found: %s \n " ,  used_propname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2009-11-29 06:04:39 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but =  uiDefAutoButR ( block ,  ptr ,  prop ,  layer ,  " " ,  icon ,  0 ,  0 ,  10 ,  10 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												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 **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  int  list_item_icon_get ( bContext  * C ,  PointerRNA  * itemptr ,  int  rnaicon )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* get icon from ID */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( id )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-03 08:37:18 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										icon =  ui_id_icon_get ( C ,  id ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( icon ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											return  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									return  rnaicon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  list_item_row ( bContext  * C ,  uiLayout  * layout ,  PointerRNA  * ptr ,  PointerRNA  * itemptr ,  int  i ,  int  rnaicon ,  PointerRNA  * activeptr ,  char  * activepropname )  
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									Object  * ob ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									char  * name ,  * namebuf ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  icon ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									overlap =  uiLayoutOverlap ( layout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* list item behind label & other buttons */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub =  uiLayoutRow ( overlap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( itemptr - > type  = =  & RNA_ShapeKey )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										ob =  ( Object * ) activeptr - > data ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 17:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										if ( ob - > mode  = =  OB_MODE_EDIT  & &  ! ( ob - > type  = =  OB_MESH ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiLayoutSetEnabled ( sub ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but =  uiDefButR ( block ,  LISTROW ,  0 ,  " " ,  0 , 0 ,  UI_UNIT_X * 10 , UI_UNIT_Y ,  activeptr ,  activepropname ,  0 ,  0 ,  i ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiButSetFlag ( but ,  UI_BUT_NO_TOOLTIP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									sub =  uiLayoutRow ( overlap ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									/* retrieve icon and name */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									icon =  list_item_icon_get ( C ,  itemptr ,  rnaicon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( ! icon  | |  icon  = =  ICON_DOT ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										icon =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									namebuf =  RNA_struct_name_get_alloc ( itemptr ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									name =  ( namebuf ) ?  namebuf :  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* hardcoded types */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( itemptr - > type  = =  & RNA_MeshTextureFaceLayer  | |  itemptr - > type  = =  & RNA_MeshColorLayer )  { 
							 
						 
					
						
							
								
									
										
										
										
											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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefButR ( block ,  OPTION ,  0 ,  " " ,  0 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  itemptr ,  " enabled " ,  0 ,  0 ,  0 ,  0 ,  0 ,   NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									else  if ( itemptr - > type  = =  & RNA_ShapeKey )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 16:35:51 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										ob =  ( Object * ) activeptr - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-10 14:47:07 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										split =  uiLayoutSplit ( sub ,  0.75f ,  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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( i  = =  0 )  uiItemL ( row ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										else  uiItemR ( row ,  itemptr ,  " value " ,  0 ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-22 17:12:28 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										if ( ob - > mode  = =  OB_MODE_EDIT  & &  ! ( ( ob - > shapeflag  &  OB_SHAPE_EDIT_MODE )  & &  ob - > type  = =  OB_MESH ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											uiLayoutSetActive ( row ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 15:31:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										//uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-26 19:54:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										uiBlockSetEmboss ( block ,  UI_EMBOSS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( namebuf ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										MEM_freeN ( namebuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								void  uiTemplateList ( uiLayout  * layout ,  bContext  * C ,  PointerRNA  * ptr ,  char  * propname ,  PointerRNA  * activeptr ,  char  * activepropname ,  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 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									char  * name ,  str [ 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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateList: only works inside a panel. \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											printf ( " uiTemplateList: property not found: %s \n " ,  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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateList: property not found: %s \n " ,  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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											printf ( " uiTemplateList: expected collection property. \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										printf ( " uiTemplateList: expected integer property. \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( i  = =  9 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													row =  uiLayoutRow ( col ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												icon =  list_item_icon_get ( C ,  & itemptr ,  rnaicon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-21 20:58:10 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												but =  uiDefIconButR ( block ,  LISTROW ,  0 ,  icon ,  0 , 0 , UI_UNIT_X * 10 , UI_UNIT_Y ,  activeptr ,  activepropname ,  0 ,  0 ,  i ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												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 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										found =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													name =  RNA_struct_name_get_alloc ( & itemptr ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-28 18:33:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													icon =  list_item_icon_get ( C ,  & itemptr ,  rnaicon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-15 19:20:59 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
													uiItemL ( row ,  ( name ) ?  name :  " " ,  icon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( name ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
														MEM_freeN ( name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
											uiItemL ( row ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 14:16:56 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-01 22:25:49 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										/* next/prev button */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										sprintf ( str ,  " %d : " ,  i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										but =  uiDefIconTextButR ( block ,  NUM ,  0 ,  0 ,  str ,  0 , 0 , UI_UNIT_X * 5 , UI_UNIT_Y ,  activeptr ,  activepropname ,  0 ,  0 ,  0 ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													list_item_row ( C ,  col ,  ptr ,  & itemptr ,  i ,  rnaicon ,  activeptr ,  activepropname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											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 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-27 01:15:31 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												uiItemL ( col ,  " " ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 **************************/  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 19:36:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  operator_call_cb ( bContext  * C ,  void  * 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 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 19:36:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								static  void  operator_search_cb ( const  bContext  * C ,  void  * arg ,  char  * str ,  uiSearchItems  * items )  
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									wmOperatorType  * ot  =  WM_operatortype_first ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									for ( ;  ot ;  ot =  ot - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												BLI_strncpy ( name ,  ot - > name ,  256 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												/* check for hotkey */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( len  <  256 - 6 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													if ( WM_key_event_operator_string ( C ,  ot - > idname ,  WM_OP_EXEC_DEFAULT ,  NULL ,  & name [ len + 1 ] ,  256 - len - 1 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
														name [ len ] =  ' | ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												if ( 0 = = uiSearchItemAdd ( items ,  name ,  ot ,  0 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								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 
  
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								static  void  do_running_jobs ( bContext  * C ,  void  * arg ,  int  event )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									switch ( event )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  B_STOPRENDER : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											G . afbreek =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										case  B_STOPCAST : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											WM_jobs_stop ( CTX_wm_manager ( C ) ,  CTX_wm_screen ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											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 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											WM_jobs_stop ( CTX_wm_manager ( C ) ,  CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								void  uiTemplateRunningJobs ( uiLayout  * layout ,  bContext  * C )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									bScreen  * screen =  CTX_wm_screen ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									Scene  * scene =  CTX_data_scene ( 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-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									void  * owner ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
										owner  =  sa ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										handle_event =  B_STOPCOMPO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										owner  =  scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										handle_event =  B_STOPRENDER ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-13 17:15:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-27 08:22:16 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( WM_jobs_test ( wm ,  owner ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiLayout  * abs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										abs  =  uiLayoutAbsolute ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  BUT ,  handle_event ,  ICON_PANEL_CLOSE ,  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												0 ,  UI_UNIT_Y * 0.1 ,  UI_UNIT_X * 0.8 ,  UI_UNIT_Y * 0.8 ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " Stop this job " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefBut ( block ,  PROGRESSBAR ,  0 ,  WM_jobs_name ( wm ,  owner ) ,  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
												UI_UNIT_X ,  0 ,  100 ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  WM_jobs_progress ( wm ,  owner ) ,  0 ,  " Progress " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										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 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconTextBut ( block ,  BUT ,  B_STOPCAST ,  ICON_CANCEL ,  " Capture " ,  0 , 0 , 85 , UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " Stop screencast " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( screen - > animtimer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconTextBut ( block ,  BUT ,  B_STOPANIM ,  ICON_CANCEL ,  " Anim Player " ,  0 , 0 , 100 , UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " 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-06-03 07:27:55 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									uiLayout  * abs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlock  * block ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBut  * but ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiStyle  * style =  U . uistyles . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									int  width ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									float  hsv [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* if the report display has timed out, don't show */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! reports - > reporttimer )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rti =  ( ReportTimerInfo  * ) reports - > reporttimer - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if  ( ! rti  | |  rti - > widthfac = = 0.0  | |  ! report )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									abs  =  uiLayoutAbsolute ( layout ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									block =  uiLayoutGetBlock ( abs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									rgb_to_hsv ( rti - > col [ 0 ] ,  rti - > col [ 1 ] ,  rti - > col [ 2 ] ,  hsv + 0 ,  hsv + 1 ,  hsv + 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									copy_v3_v3 ( but - > hsv ,  hsv ) ; 			/* set the report's bg colour in but->hsv - ROUNDBOX feature */ 
							 
						 
					
						
							
								
									
										
											 
										
											
												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 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
									but =  uiDefBut ( block ,  ROUNDBOX ,  0 ,  " " ,  UI_UNIT_X + 10 ,  0 ,  UI_UNIT_X + width ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but - > hsv [ 0 ]  =  but - > hsv [ 1 ]  =  0.0 ; 	/* set a greyscale bg colour in but->hsv - ROUNDBOX feature */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									but - > hsv [ 2 ]  =  rti - > greyscale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									uiBlockEndAlign ( block ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									/* icon and report message on top */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									if ( report - > type  &  RPT_ERROR_ALL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  LABEL ,  0 ,  ICON_ERROR ,  2 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( report - > type  &  RPT_WARNING_ALL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  LABEL ,  0 ,  ICON_ERROR ,  2 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									else  if ( report - > type  &  RPT_INFO_ALL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
										uiDefIconBut ( block ,  LABEL ,  0 ,  ICON_INFO ,  2 ,  0 ,  UI_UNIT_X ,  UI_UNIT_Y ,  NULL ,  0.0f ,  0.0f ,  0 ,  0 ,  " " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
									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