2011-02-23 10:52:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 *  * * * * *  BEGIN  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  This  program  is  free  software ;  you  can  redistribute  it  and / or 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  modify  it  under  the  terms  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  as  published  by  the  Free  Software  Foundation ;  either  version  2 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  of  the  License ,  or  ( at  your  option )  any  later  version . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  This  program  is  distributed  in  the  hope  that  it  will  be  useful , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  but  WITHOUT  ANY  WARRANTY ;  without  even  the  implied  warranty  of 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR  PURPOSE .   See  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  GNU  General  Public  License  for  more  details . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  You  should  have  received  a  copy  of  the  GNU  General  Public  License 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  along  with  this  program ;  if  not ,  write  to  the  Free  Software  Foundation , 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-12 13:34:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  Inc . ,  51  Franklin  Street ,  Fifth  Floor ,  Boston ,  MA  02110 - 1301 ,  USA . 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  The  Original  Code  is  Copyright  ( C )  2001 - 2002  by  NaN  Holding  BV . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  All  rights  reserved . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  Contributor ( s ) :  Blender  Foundation ,  2002 - 2009 ,  Xavier  Thomas 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-27 20:29:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/** \file blender/editors/space_image/image_ops.c
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *   \ ingroup  spimage 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-17 07:20:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <stddef.h> 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  <string.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <fcntl.h> 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  <stdlib.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-03 17:47:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <errno.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# ifndef WIN32 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#   include <unistd.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# else 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#   include <io.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "MEM_guardedalloc.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BLI_math.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BLI_blenlib.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BLI_utildefines.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BLI_string_utf8.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-07 18:36:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-16 17:32:01 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BLT_translation.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 17:32:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "DNA_object_types.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-23 14:34:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "DNA_node_types.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "DNA_packedFile_types.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "DNA_scene_types.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-06 00:04:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "DNA_screen_types.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_colortools.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_context.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-18 19:28:33 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_depsgraph.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_DerivedMesh.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2013-06-15 15:39:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_icons.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_image.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_global.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_library.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-13 13:09:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_main.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_packedFile.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_paint.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_report.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_screen.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_sound.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_scene.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "GPU_draw.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "GPU_buffers.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "IMB_colormanagement.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "IMB_imbuf.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "IMB_imbuf_types.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "IMB_moviecache.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "intern/openexr/openexr_multi.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "RE_pipeline.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "RNA_access.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "RNA_define.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-28 20:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "RNA_enum_types.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-09 20:58:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_image.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-11 22:46:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_mask.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-23 21:59:34 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_paint.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-03 15:18:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_render.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "ED_screen.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_space_api.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "ED_uvedit.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-26 14:18:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_util.h" 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "UI_interface.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "UI_resources.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "UI_view2d.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "WM_api.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "WM_types.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "PIL_time.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-12-18 13:24:21 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "RE_engine.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "image_intern.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/******************** view navigation utilities *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-08 12:54:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  sima_zoom_set ( SpaceImage  * sima ,  ARegion  * ar ,  float  zoom ,  const  float  location [ 2 ] ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  oldzoom  =  sima - > zoom ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									int  width ,  height ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima - > zoom  =  zoom ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > zoom  <  0.1f  | |  sima - > zoom  >  4.0f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* check zoom limits */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 16:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_get_size ( sima ,  & width ,  & height ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										width  * =  sima - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										height  * =  sima - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-14 00:54:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( width  <  4 )  & &  ( height  <  4 )  & &  sima - > zoom  <  oldzoom ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											sima - > zoom  =  oldzoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-15 11:48:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										else  if  ( BLI_rcti_size_x ( & ar - > winrct )  < =  sima - > zoom ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											sima - > zoom  =  oldzoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-15 11:48:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										else  if  ( BLI_rcti_size_y ( & ar - > winrct )  < =  sima - > zoom ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											sima - > zoom  =  oldzoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ( U . uiflag  &  USER_ZOOM_TO_MOUSEPOS )  & &  location )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  aspx ,  aspy ,  w ,  h ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 16:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_get_size ( sima ,  & width ,  & height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ED_space_image_get_aspect ( sima ,  & aspx ,  & aspy ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										w  =  width  *  aspx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										h  =  height  *  aspy ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > xof  + =  ( ( location [ 0 ]  -  0.5f )  *  w  -  sima - > xof )  *  ( sima - > zoom  -  oldzoom )  /  sima - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima - > yof  + =  ( ( location [ 1 ]  -  0.5f )  *  h  -  sima - > yof )  *  ( sima - > zoom  -  oldzoom )  /  sima - > zoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-05-08 12:54:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  sima_zoom_set_factor ( SpaceImage  * sima ,  ARegion  * ar ,  float  zoomfac ,  const  float  location [ 2 ] ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima_zoom_set ( sima ,  ar ,  sima - > zoom  *  zoomfac ,  location ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/**
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Fits  the  view  to  the  bounds  exactly ,  caller  should  add  margin  if  needed . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  sima_zoom_set_from_bounds ( SpaceImage  * sima ,  ARegion  * ar ,  const  rctf  * bounds ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  image_size [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  aspx ,  aspy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_space_image_get_size ( sima ,  & image_size [ 0 ] ,  & image_size [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_space_image_get_aspect ( sima ,  & aspx ,  & aspy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									image_size [ 0 ]  =  image_size [ 0 ]  *  aspx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									image_size [ 1 ]  =  image_size [ 1 ]  *  aspy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* adjust offset and zoom */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima - > xof  =  roundf ( ( BLI_rctf_cent_x ( bounds )  -  0.5f )  *  image_size [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima - > yof  =  roundf ( ( BLI_rctf_cent_y ( bounds )  -  0.5f )  *  image_size [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  size_xy [ 2 ] ,  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									size_xy [ 0 ]  =  BLI_rcti_size_x ( & ar - > winrct )  /  ( BLI_rctf_size_x ( bounds )  *  image_size [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									size_xy [ 1 ]  =  BLI_rcti_size_y ( & ar - > winrct )  /  ( BLI_rctf_size_y ( bounds )  *  image_size [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									size  =  min_ff ( size_xy [ 0 ] ,  size_xy [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CLAMP_MAX ( size ,  100.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima_zoom_set ( sima ,  ar ,  size ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-19 07:28:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								#if 0  // currently unused
 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 22:00:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ( CTX_data_edit_image ( C )  ! =  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-19 07:28:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 22:00:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  space_image_buffer_exists_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima  & &  ED_space_image_has_buffer ( sima ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-20 05:19:47 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_not_packed_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Do not run 'replace' on packed images, it does not give user expected results at all. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( sima  & &  sima - > image  & &  BLI_listbase_is_empty ( & sima - > image - > packedfiles ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 21:31:41 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  imbuf_format_writeable ( const  ImBuf  * ibuf ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageFormatData  im_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImbFormatOptions  options_dummy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BKE_imbuf_to_image_format ( & im_format ,  ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ( BKE_image_imtype_to_ftype ( im_format . imtype ,  & options_dummy )  = =  ibuf - > ftype ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  space_image_file_exists_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( space_image_buffer_exists_poll ( C ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImBuf  * ibuf ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										void  * lock ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-11 11:25:41 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  ret  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-21 14:09:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										char  name [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ibuf  =  ED_space_image_acquire_buffer ( sima ,  & lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-21 14:09:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BLI_strncpy ( name ,  ibuf - > name ,  FILE_MAX ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-05 15:10:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BLI_path_abs ( name ,  BKE_main_blendfile_path ( bmain ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( BLI_exists ( name )  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												CTX_wm_operator_poll_msg_set ( C ,  " image file not found " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-05 03:53:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  if  ( ! BLI_file_is_writable ( name ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												CTX_wm_operator_poll_msg_set ( C ,  " image path can't be written to " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-08-24 21:31:41 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  if  ( ! imbuf_format_writeable ( ibuf ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												CTX_wm_operator_poll_msg_set ( C ,  " image format is read-only " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ret  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-21 14:09:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  ret ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								#if 0   /* UNUSED */
 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  space_image_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-19 07:28:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima  & &  sima - > image )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-19 07:28:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-19 07:28:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								bool  space_image_main_region_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* XXX ARegion *ar = CTX_wm_region(C); */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:18:58 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  true ;   /* XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW); */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 01:59:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */ 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  space_image_main_area_not_uv_brush_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 01:59:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ToolSettings  * toolsettings  =  scene - > toolsettings ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-28 01:59:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima  & &  ! toolsettings - > uvsculpt  & &  ! scene - > obedit ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_sample_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-01 14:29:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Object  * obedit  =  CTX_data_edit_object ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ToolSettings  * toolsettings  =  scene - > toolsettings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( obedit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ED_space_image_show_uvedit ( sima ,  obedit )  & &  ( toolsettings - > use_uv_sculpt ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-01 14:29:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( sima - > mode  ! =  SI_MODE_VIEW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-01 14:29:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  space_image_main_region_poll ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-01 14:29:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-26 09:06:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-17 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/********************** view pan operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								typedef  struct  ViewPanData  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  x ,  y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  xof ,  yof ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-22 15:20:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  event_type ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}  ViewPanData ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_view_pan_init ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									ViewPanData  * vpd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									op - > customdata  =  vpd  =  MEM_callocN ( sizeof ( ViewPanData ) ,  " ImageViewPanData " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-06 22:34:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_modal_set ( CTX_wm_window ( C ) ,  BC_NSEW_SCROLLCURSOR ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vpd - > x  =  event - > x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > y  =  event - > y ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > xof  =  sima - > xof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > yof  =  sima - > yof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > event_type  =  event - > type ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-18 12:43:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_modal_handler ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_view_pan_exit ( bContext  * C ,  wmOperator  * op ,  bool  cancel ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ViewPanData  * vpd  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( cancel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > xof  =  vpd - > xof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima - > yof  =  vpd - > yof ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-06 22:34:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_modal_restore ( CTX_wm_window ( C ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_pan_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  offset [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_float_get_array ( op - > ptr ,  " offset " ,  offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima - > xof  + =  offset [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima - > yof  + =  offset [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* XXX notifier? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( image_preview_active ( curarea ,  NULL ,  NULL ) )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* recalculates new preview rect */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scrarea_do_windraw ( curarea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										image_preview_event ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_pan_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( event - > type  = =  MOUSEPAN )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  offset [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-05 17:57:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										offset [ 0 ]  =  ( event - > prevx  -  event - > x )  /  sima - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										offset [ 1 ]  =  ( event - > prevy  -  event - > y )  /  sima - > zoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_float_set_array ( op - > ptr ,  " offset " ,  offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										image_view_pan_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										image_view_pan_init ( C ,  op ,  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_pan_modal ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ViewPanData  * vpd  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  offset [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									switch  ( event - > type )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										case  MOUSEMOVE : 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											sima - > xof  =  vpd - > xof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sima - > yof  =  vpd - > yof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											offset [ 0 ]  =  ( vpd - > x  -  event - > x )  /  sima - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											offset [ 1 ]  =  ( vpd - > y  -  event - > y )  /  sima - > zoom ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											RNA_float_set_array ( op - > ptr ,  " offset " ,  offset ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											image_view_pan_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-22 15:20:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										default : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-20 19:49:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( event - > type  = =  vpd - > event_type  & &  event - > val  = =  KM_RELEASE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												image_view_pan_exit ( C ,  op ,  false ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_view_pan_cancel ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_view_pan_exit ( C ,  op ,  true ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_pan ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View Pan " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_pan " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Pan the view " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_pan_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_view_pan_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  image_view_pan_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_view_pan_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-11 14:51:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-27 18:44:27 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_BLOCKING  |  OPTYPE_GRAB_CURSOR  |  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-16 23:53:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_float_vector ( ot - > srna ,  " offset " ,  2 ,  NULL ,  - FLT_MAX ,  FLT_MAX , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									                     " Offset " ,  " Offset in floating point units, 1.0 is the width and height of the image " ,  - FLT_MAX ,  FLT_MAX ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************** view zoom operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								typedef  struct  ViewZoomData  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  origx ,  origy ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  zoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-22 15:20:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  event_type ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  location [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* needed for continuous zoom */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									wmTimer  * timer ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									double  timer_lastdraw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}  ViewZoomData ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_view_zoom_init ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									ViewZoomData  * vpd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									op - > customdata  =  vpd  =  MEM_callocN ( sizeof ( ViewZoomData ) ,  " ImageViewZoomData " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-06 22:34:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_modal_set ( CTX_wm_window ( C ) ,  BC_NSEW_SCROLLCURSOR ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vpd - > origx  =  event - > x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > origy  =  event - > y ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vpd - > zoom  =  sima - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > event_type  =  event - > type ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  event - > mval [ 0 ] ,  event - > mval [ 1 ] ,  & vpd - > location [ 0 ] ,  & vpd - > location [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( U . viewzoom  = =  USER_ZOOM_CONT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* needs a timer to continue redrawing */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vpd - > timer  =  WM_event_add_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  TIMER ,  0.01f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vpd - > timer_lastdraw  =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > sima  =  sima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vpd - > ar  =  ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-18 12:43:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_modal_handler ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_view_zoom_exit ( bContext  * C ,  wmOperator  * op ,  bool  cancel ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ViewZoomData  * vpd  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( cancel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > zoom  =  vpd - > zoom ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-06 02:05:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( vpd - > timer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										WM_event_remove_timer ( CTX_wm_manager ( C ) ,  vpd - > timer - > win ,  vpd - > timer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-06 22:34:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_modal_restore ( CTX_wm_window ( C ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima_zoom_set_factor ( sima ,  ar ,  RNA_float_get ( op - > ptr ,  " factor " ) ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* XXX notifier? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( image_preview_active ( curarea ,  NULL ,  NULL ) )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* recalculates new preview rect */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scrarea_do_windraw ( curarea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										image_preview_event ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								enum  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VIEW_PASS  =  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VIEW_APPLY , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VIEW_CONFIRM 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-29 13:21:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( event - > type  = =  MOUSEZOOM  | |  event - > type  = =  MOUSEPAN )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-13 16:42:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  delta ,  factor ,  location [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										UI_view2d_region_to_view ( & ar - > v2d ,  event - > mval [ 0 ] ,  event - > mval [ 1 ] ,  & location [ 0 ] ,  & location [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-06 11:16:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										delta  =  event - > prevx  -  event - > x  +  event - > prevy  -  event - > y ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-13 16:42:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( U . uiflag  &  USER_ZOOM_INVERT ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											delta  * =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										factor  =  1.0f  +  delta  /  300.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_float_set ( op - > ptr ,  " factor " ,  factor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima_zoom_set ( sima ,  ar ,  sima - > zoom  *  factor ,  location ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										image_view_zoom_init ( C ,  op ,  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-11 11:14:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_zoom_apply ( ViewZoomData  * vpd ,  wmOperator  * op ,  const  int  x ,  const  int  y ,  const  short  viewzoom ,  const  short  zoom_invert ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  factor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( viewzoom  = =  USER_ZOOM_CONT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										double  time  =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  time_step  =  ( float ) ( time  -  vpd - > timer_lastdraw ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  fac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  zfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( U . uiflag  &  USER_ZOOM_HORIZ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fac  =  ( float ) ( x  -  vpd - > origx ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fac  =  ( float ) ( y  -  vpd - > origy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( zoom_invert )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fac  =  - fac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* oldstyle zoom */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										zfac  =  1.0f  +  ( ( fac  /  20.0f )  *  time_step ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vpd - > timer_lastdraw  =  time ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* this is the final zoom, but instead make it into a factor */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										//zoom = vpd->sima->zoom * zfac;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										factor  =  ( vpd - > sima - > zoom  *  zfac )  /  vpd - > zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* for now do the same things for scale and dolly */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  delta  =  x  -  vpd - > origx  +  y  -  vpd - > origy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( zoom_invert ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											delta  * =  - 1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										factor  =  1.0f  +  delta  /  300.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_float_set ( op - > ptr ,  " factor " ,  factor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima_zoom_set ( vpd - > sima ,  vpd - > ar ,  vpd - > zoom  *  factor ,  vpd - > location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( vpd - > ar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_modal ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ViewZoomData  * vpd  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									short  event_code  =  VIEW_PASS ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-13 16:42:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* execute the events */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( event - > type  = =  TIMER  & &  event - > customdata  = =  vpd - > timer )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* continuous zoom */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										event_code  =  VIEW_APPLY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( event - > type  = =  MOUSEMOVE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										event_code  =  VIEW_APPLY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( event - > type  = =  vpd - > event_type  & &  event - > val  = =  KM_RELEASE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										event_code  =  VIEW_CONFIRM ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-13 16:42:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( event_code  = =  VIEW_APPLY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										image_zoom_apply ( vpd ,  op ,  event - > x ,  event - > y ,  U . viewzoom ,  ( U . uiflag  &  USER_ZOOM_INVERT )  ! =  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( event_code  = =  VIEW_CONFIRM )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										image_view_zoom_exit ( C ,  op ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-25 13:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_view_zoom_cancel ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_view_zoom_exit ( C ,  op ,  true ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_zoom ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-30 16:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View Zoom " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_zoom " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Zoom in/out the image " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_zoom_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_view_zoom_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  image_view_zoom_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_view_zoom_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-11 14:51:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-27 18:44:27 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_BLOCKING  |  OPTYPE_GRAB_CURSOR  |  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-30 16:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_float ( ot - > srna ,  " factor " ,  0.0f ,  - FLT_MAX ,  FLT_MAX ,  " Factor " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									                     " Zoom factor, values higher than 1.0 zoom in, lower values zoom out " ,  - FLT_MAX ,  FLT_MAX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_HIDDEN ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-08-18 00:21:55 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# ifdef WITH_INPUT_NDOF 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/********************** NDOF operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Combined pan/zoom from a 3D mouse device.
 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-27 20:12:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  Z  zooms ,  XY  pans 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  " view "  ( not  " paper " )  control  - -  user  moves  the  viewpoint ,  not  the  image  being  viewed 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  that  explains  the  negative  signs  in  the  code  below 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_ndof_invoke ( bContext  * C ,  wmOperator  * UNUSED ( op ) ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 22:31:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( event - > type  ! =  NDOF_MOTION ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-18 23:51:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  pan_vec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-22 16:19:02 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  wmNDOFMotionData  * ndof  =  event - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  float  speed  =  NDOF_PIXELS_PER_SECOND ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-18 23:51:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										WM_event_ndof_pan_get ( ndof ,  pan_vec ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-18 10:19:41 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-22 16:19:02 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_v2_fl ( pan_vec ,  ( speed  *  ndof - > dt )  /  sima - > zoom ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										pan_vec [ 2 ]  * =  - ndof - > dt ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-18 10:19:41 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-18 23:51:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima_zoom_set_factor ( sima ,  ar ,  1.0f  +  pan_vec [ 2 ] ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-18 10:19:41 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > xof  + =  pan_vec [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima - > yof  + =  pan_vec [ 1 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-21 05:46:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-06 22:31:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_ndof ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " NDOF Pan/Zoom " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_ndof " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Use a 3D mouse device to pan/zoom the view " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_view_ndof_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
  (see below) or values are even possible to run or change.
  This prevents any kind of "destructive" action performed
  from user while rendering.
- Locks interface refresh for regions which does have lock
  set to truth in their template. Currently it's just a 3D
  viewport, but in the future more regions could be considered
  unsafe, or we could want to lock different parts of
  interface when doing different jobs.
  This is needed because 3D viewport could be using or changing
  the same data as renderer currently uses, leading to threading
  conflict.
  Notifiers are still allowed to handle, so render progress is
  seen on the screen, but would need to doublecheck on this, in
  terms some notifiers could be changing the data.
  For now interface locking happens for render job only in case
  "Lock Interface" checkbox is enabled.
  Other tools like backing would also benefit of this option.
  It is possible to mark operator as safe to be used in locked
  interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
  template flags.
  This bit is completely handled by wm_evem_system, not
  with operator run routines, so it's still possible to
  run operators from drivers and handlers.
  Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
											 
										 
										
											2014-01-29 16:07:14 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2016-08-18 00:21:55 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif  /* WITH_INPUT_NDOF */ 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-25 18:51:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/********************** view all operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Updates the fields of the View2D member of the SpaceImage struct.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Default  behavior  is  to  reset  the  position  of  the  image  and  set  the  zoom  to  1 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  If  the  image  will  not  fit  within  the  window  rectangle ,  the  zoom  is  adjusted  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-20 23:40:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_all_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  aspx ,  aspy ,  zoomx ,  zoomy ,  w ,  h ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  width ,  height ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  fit_view  =  RNA_boolean_get ( op - > ptr ,  " fit_view " ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* retrieve state */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 16:30:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_space_image_get_size ( sima ,  & width ,  & height ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_space_image_get_aspect ( sima ,  & aspx ,  & aspy ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									w  =  width  *  aspx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									h  =  height  *  aspy ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-08-11 22:12:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* check if the image will fit in the image with (zoom == 1) */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-15 11:48:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									width   =  BLI_rcti_size_x ( & ar - > winrct )  +  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									height  =  BLI_rcti_size_y ( & ar - > winrct )  +  1 ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-20 23:40:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( fit_view )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  int  margin  =  5 ;  /* margin from border */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										zoomx  =  ( float )  width  /  ( w  +  2  *  margin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										zoomy  =  ( float )  height  /  ( h  +  2  *  margin ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima_zoom_set ( sima ,  ar ,  min_ff ( zoomx ,  zoomy ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ( w  > =  width  | |  h  > =  height )  & &  ( width  >  0  & &  height  >  0 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											zoomx  =  ( float )  width  /  w ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											zoomy  =  ( float )  height  /  h ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* find the zoom value that will fit the image in the image space */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sima_zoom_set ( sima ,  ar ,  1.0f  /  power_of_2 ( 1.0f  /  min_ff ( zoomx ,  zoomy ) ) ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sima_zoom_set ( sima ,  ar ,  1.0f ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima - > xof  =  sima - > yof  =  0.0f ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_all ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-20 23:40:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View All " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_all " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-04 18:05:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " View the entire image " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_all_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-08-20 23:40:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-07 17:13:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-08-20 23:40:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_boolean ( ot - > srna ,  " fit_view " ,  0 ,  " Fit View " ,  " Fit frame to the viewport " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_SKIP_SAVE ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************** view selected operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_selected_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Object  * obedit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Image  * ima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* retrieve state */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									obedit  =  CTX_data_edit_object ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ima  =  ED_space_image ( sima ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* get bounds */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  min [ 2 ] ,  max [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-11 22:46:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ED_space_image_show_uvedit ( sima ,  obedit ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! ED_uvedit_minmax ( scene ,  ima ,  obedit ,  min ,  max ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-11 22:46:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-11 22:46:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( ED_space_image_check_show_maskedit ( scene ,  sima ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! ED_mask_selected_minmax ( C ,  min ,  max ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rctf  bounds  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									    . xmin  =  min [ 0 ] ,  . ymin  =  min [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									    . xmax  =  max [ 0 ] ,  . ymax  =  max [ 1 ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* add some margin */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BLI_rctf_scale ( & bounds ,  1.4f ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-28 13:25:26 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima_zoom_set_from_bounds ( sima ,  ar ,  & bounds ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_view_selected_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-09 01:44:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  ( space_image_main_region_poll ( C )  & &  ( ED_operator_uvedit ( C )  | |  ED_operator_mask ( C ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-09 01:44:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_selected ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View Center " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_selected " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " View all selected UVs " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_selected_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_view_selected_poll ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************** view zoom in/out operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_in_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  location [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_float_get_array ( op - > ptr ,  " location " ,  location ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-03 09:24:09 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima_zoom_set_factor ( sima ,  ar ,  powf ( 2.0f ,  1.0f  /  3.0f ) ,  location ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_in_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  location [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  event - > mval [ 0 ] ,  event - > mval [ 1 ] ,  & location [ 0 ] ,  & location [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_float_set_array ( op - > ptr ,  " location " ,  location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  image_view_zoom_in_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_zoom_in ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-30 16:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View Zoom In " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_zoom_in " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Zoom in the image (centered around 2D cursor) " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_view_zoom_in_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_zoom_in_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
  (see below) or values are even possible to run or change.
  This prevents any kind of "destructive" action performed
  from user while rendering.
- Locks interface refresh for regions which does have lock
  set to truth in their template. Currently it's just a 3D
  viewport, but in the future more regions could be considered
  unsafe, or we could want to lock different parts of
  interface when doing different jobs.
  This is needed because 3D viewport could be using or changing
  the same data as renderer currently uses, leading to threading
  conflict.
  Notifiers are still allowed to handle, so render progress is
  seen on the screen, but would need to doublecheck on this, in
  terms some notifiers could be changing the data.
  For now interface locking happens for render job only in case
  "Lock Interface" checkbox is enabled.
  Other tools like backing would also benefit of this option.
  It is possible to mark operator as safe to be used in locked
  interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
  template flags.
  This bit is completely handled by wm_evem_system, not
  with operator run routines, so it's still possible to
  run operators from drivers and handlers.
  Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
											 
										 
										
											2014-01-29 16:07:14 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-30 16:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_float_vector ( ot - > srna ,  " location " ,  2 ,  NULL ,  - FLT_MAX ,  FLT_MAX , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									                            " Location " ,  " Cursor location in screen coordinates " ,  - 10.0f ,  10.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_HIDDEN ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_out_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  location [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_float_get_array ( op - > ptr ,  " location " ,  location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-03 09:24:09 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima_zoom_set_factor ( sima ,  ar ,  powf ( 0.5f ,  1.0f  /  3.0f ) ,  location ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_out_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  location [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  event - > mval [ 0 ] ,  event - > mval [ 1 ] ,  & location [ 0 ] ,  & location [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_float_set_array ( op - > ptr ,  " location " ,  location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  image_view_zoom_out_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_zoom_out ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-30 16:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View Zoom Out " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_zoom_out " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Zoom out the image (centered around 2D cursor) " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_view_zoom_out_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_zoom_out_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
  (see below) or values are even possible to run or change.
  This prevents any kind of "destructive" action performed
  from user while rendering.
- Locks interface refresh for regions which does have lock
  set to truth in their template. Currently it's just a 3D
  viewport, but in the future more regions could be considered
  unsafe, or we could want to lock different parts of
  interface when doing different jobs.
  This is needed because 3D viewport could be using or changing
  the same data as renderer currently uses, leading to threading
  conflict.
  Notifiers are still allowed to handle, so render progress is
  seen on the screen, but would need to doublecheck on this, in
  terms some notifiers could be changing the data.
  For now interface locking happens for render job only in case
  "Lock Interface" checkbox is enabled.
  Other tools like backing would also benefit of this option.
  It is possible to mark operator as safe to be used in locked
  interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
  template flags.
  This bit is completely handled by wm_evem_system, not
  with operator run routines, so it's still possible to
  run operators from drivers and handlers.
  Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
											 
										 
										
											2014-01-29 16:07:14 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-30 16:38:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_float_vector ( ot - > srna ,  " location " ,  2 ,  NULL ,  - FLT_MAX ,  FLT_MAX , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									                            " Location " ,  " Cursor location in screen coordinates " ,  - 10.0f ,  10.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_HIDDEN ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************** view zoom ratio operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_ratio_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-02-24 14:01:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima_zoom_set ( sima ,  ar ,  RNA_float_get ( op - > ptr ,  " ratio " ) ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* ensure pixel exact locations for draw */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima - > xof  =  ( int ) sima - > xof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima - > yof  =  ( int ) sima - > yof ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* XXX notifier? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( image_preview_active ( curarea ,  NULL ,  NULL ) )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* recalculates new preview rect */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scrarea_do_windraw ( curarea ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										image_preview_event ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 07:48:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_zoom_ratio ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " View Zoom Ratio " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_zoom_ratio " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-04 18:05:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Set zoom ratio of the view " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_zoom_ratio_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-26 17:24:42 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Option to lock the interface while rendering
Added function called WM_set_locked_interface which does
two things:
- Prevents event queue from being handled, so no operators
  (see below) or values are even possible to run or change.
  This prevents any kind of "destructive" action performed
  from user while rendering.
- Locks interface refresh for regions which does have lock
  set to truth in their template. Currently it's just a 3D
  viewport, but in the future more regions could be considered
  unsafe, or we could want to lock different parts of
  interface when doing different jobs.
  This is needed because 3D viewport could be using or changing
  the same data as renderer currently uses, leading to threading
  conflict.
  Notifiers are still allowed to handle, so render progress is
  seen on the screen, but would need to doublecheck on this, in
  terms some notifiers could be changing the data.
  For now interface locking happens for render job only in case
  "Lock Interface" checkbox is enabled.
  Other tools like backing would also benefit of this option.
  It is possible to mark operator as safe to be used in locked
  interface mode by adding OPTYPE_ALLOW_LOCKED bit to operator
  template flags.
  This bit is completely handled by wm_evem_system, not
  with operator run routines, so it's still possible to
  run operators from drivers and handlers.
  Currently allowed image editor navigation and zooming.
Reviewers: brecht, campbellbarton
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D142
											 
										 
										
											2014-01-29 16:07:14 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_LOCK_BYPASS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-11 23:46:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_float ( ot - > srna ,  " ratio " ,  0.0f ,  - FLT_MAX ,  FLT_MAX , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									              " Ratio " ,  " Zoom ratio, 1.0 is 1:1, higher is zoomed in, lower is zoomed out " ,  - FLT_MAX ,  FLT_MAX ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-07 04:22:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/********************** view border-zoom operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  image_view_zoom_border_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rctf  bounds ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 21:58:51 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  zoom_in  =  ! RNA_boolean_get ( op - > ptr ,  " zoom_out " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-07 04:22:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_operator_properties_border_to_rctf ( op ,  & bounds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view_rctf ( & ar - > v2d ,  & bounds ,  & bounds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  struct  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  xof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  yof ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  sima_view_prev  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										. xof  =  sima - > xof , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										. yof  =  sima - > yof , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										. zoom  =  sima - > zoom , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sima_zoom_set_from_bounds ( sima ,  ar ,  & bounds ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* zoom out */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 21:58:51 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! zoom_in )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-07 04:22:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > xof  =  sima_view_prev . xof  +  ( sima - > xof  -  sima_view_prev . xof ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima - > yof  =  sima_view_prev . yof  +  ( sima - > yof  -  sima_view_prev . yof ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima - > zoom  =  sima_view_prev . zoom  *  ( sima_view_prev . zoom  /  sima - > zoom ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( ar ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_view_zoom_border ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name  =  " Zoom to Border " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > description  =  " Zoom in the view to the nearest item contained in the border " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_view_zoom_border " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 17:01:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  WM_gesture_border_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-07 04:22:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_view_zoom_border_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 17:01:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > modal  =  WM_gesture_border_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  WM_gesture_border_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-07 04:22:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* rna */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 21:58:51 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_operator_properties_gesture_border_zoom ( ot ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-07 04:22:48 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/**************** load/replace/save callbacks ******************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  image_filesel ( bContext  * C ,  wmOperator  * op ,  const  char  * path ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-14 03:52:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_string_set ( op - > ptr ,  " filepath " ,  path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_fileselect ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/******************** open image operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  struct  ImageOpenData  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PropertyPointerRNA  pprop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageUser  * iuser ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageFormatData  im_format ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}  ImageOpenData ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  struct  ImageFrameRange  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  ImageFrameRange  * next ,  * prev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ListBase  frames ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-19 09:33:23 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/**  The full path of the first file in the list of image files */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  filepath [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  ImageFrameRange ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  struct  ImageFrame  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  ImageFrame  * next ,  * prev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  framenr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  ImageFrame ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_open_init ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageOpenData  * iod ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									op - > customdata  =  iod  =  MEM_callocN ( sizeof ( ImageOpenData ) ,  __func__ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									iod - > iuser  =  CTX_data_pointer_get_type ( C ,  " image_user " ,  & RNA_ImageUser ) . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-09 21:20:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									UI_context_active_but_prop_get_templateID ( C ,  & iod - > pprop . ptr ,  & iod - > pprop . prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_open_cancel ( bContext  * UNUSED ( C ) ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									op - > customdata  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/**
 
							 
						 
					
						
							
								
									
										
										
										
											2014-05-19 18:00:20 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  \ brief  Get  a  list  of  frames  from  the  list  of  image  files  matching  the  first  file  name  sequence  pattern 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  \ param  ptr  [ in ]  the  RNA  pointer  containing  the  " directory "  entry  and  " files "  collection 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-19 09:33:23 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  \ param  frames_all  [ out ]  the  list  of  frame  numbers  found  in  the  files  matching  the  first  one  by  name 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_sequence_get_frame_ranges ( PointerRNA  * ptr ,  ListBase  * frames_all ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									char  dir [ FILE_MAXDIR ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-06 14:50:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  do_frame_range  =  RNA_boolean_get ( ptr ,  " use_sequence_detection " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageFrameRange  * frame_range  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_string_get ( ptr ,  " directory " ,  dir ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_BEGIN  ( ptr ,  itemptr ,  " files " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										char  base_head [ FILE_MAX ] ,  base_tail [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										char  head [ FILE_MAX ] ,  tail [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										unsigned  short  digits ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										char  * filename  =  RNA_string_get_alloc ( & itemptr ,  " name " ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ImageFrame  * frame  =  MEM_callocN ( sizeof ( ImageFrame ) ,  " image_frame " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* use the first file in the list as base filename */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										frame - > framenr  =  BLI_stringdec ( filename ,  head ,  tail ,  & digits ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* still in the same sequence */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-06 14:50:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( do_frame_range  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										    ( frame_range  ! =  NULL )  & & 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										    ( STREQLEN ( base_head ,  head ,  FILE_MAX ) )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										    ( STREQLEN ( base_tail ,  tail ,  FILE_MAX ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* pass */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* start a new frame range */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											frame_range  =  MEM_callocN ( sizeof ( * frame_range ) ,  __func__ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_join_dirfile ( frame_range - > filepath ,  sizeof ( frame_range - > filepath ) ,  dir ,  filename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_addtail ( frames_all ,  frame_range ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BLI_strncpy ( base_head ,  head ,  sizeof ( base_head ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_strncpy ( base_tail ,  tail ,  sizeof ( base_tail ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BLI_addtail ( & frame_range - > frames ,  frame ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										MEM_freeN ( filename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_END 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 01:28:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_cmp_frame ( const  void  * a ,  const  void  * b ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 01:28:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  ImageFrame  * frame_a  =  a ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  ImageFrame  * frame_b  =  b ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( frame_a - > framenr  <  frame_b - > framenr )  return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( frame_a - > framenr  >  frame_b - > framenr )  return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/**
 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-19 15:34:54 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  Return  the  start  ( offset )  and  the  length  of  the  sequence  of  continuous  frames  in  the  list  of  frames 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  \ param  frames :  [ in ]  the  list  of  frame  numbers ,  as  a  side - effect  the  list  is  sorted . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  \ param  ofs :  [ out ]  offset  the  first  frame  number  in  the  sequence . 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-22 23:47:05 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  \ return  the  number  of  contiguous  frames  in  the  sequence 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  image_sequence_get_len ( ListBase  * frames ,  int  * ofs ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageFrame  * frame ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-11-16 13:57:58 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BLI_listbase_sort ( frames ,  image_cmp_frame ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									frame  =  frames - > first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( frame )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  frame_curr  =  frame - > framenr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										( * ofs )  =  frame_curr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										while  ( frame  & &  ( frame - > framenr  = =  frame_curr ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											frame_curr + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											frame  =  frame - > next ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  frame_curr  -  ( * ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-20 23:51:15 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									* ofs  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  Image  * image_open_single ( 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        Main  * bmain ,  wmOperator  * op ,  const  char  * filepath ,  const  char  * relbase , 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        bool  is_relative_path ,  bool  use_multiview ,  int  frame_seq_len ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  exists  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Image  * ima  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									errno  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ima  =  BKE_image_load_exists_ex ( bmain ,  filepath ,  & exists ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! ima )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( op - > customdata )  MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_reportf ( op - > reports ,  RPT_ERROR ,  " Cannot read '%s': %s " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										            filepath ,  errno  ?  strerror ( errno )  :  TIP_ ( " unsupported image format " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! exists )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* only image path after save, never ibuf */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( is_relative_path )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_path_rel ( ima - > name ,  relbase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* handle multiview images */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( use_multiview )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ImageOpenData  * iod  =  op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ImageFormatData  * imf  =  & iod - > im_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima - > flag  | =  IMA_USE_VIEWS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima - > views_format  =  imf - > views_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											* ima - > stereo3d_format  =  imf - > stereo3d_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima - > flag  & =  ~ IMA_USE_VIEWS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BKE_image_free_views ( ima ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ( frame_seq_len  >  1 )  & &  ( ima - > source  = =  IMA_SRC_FILE ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima - > source  =  IMA_SRC_SEQUENCE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_open_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-25 11:06:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-06 00:04:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ScrArea  * sa  =  CTX_wm_area ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Object  * obedit  =  CTX_data_edit_object ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageUser  * iuser  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageOpenData  * iod  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PointerRNA  idptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  filepath [ FILE_MAX ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  frame_seq_len  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  frame_ofs  =  1 ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-02-25 11:06:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  is_relative_path  =  RNA_boolean_get ( op - > ptr ,  " relative_path " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  use_multiview     =  RNA_boolean_get ( op - > ptr ,  " use_multiview " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-25 11:06:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! op - > customdata ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										image_open_init ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_string_get ( op - > ptr ,  " filepath " ,  filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 17:52:21 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-06-17 15:57:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " directory " )  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									    RNA_struct_property_is_set ( op - > ptr ,  " files " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 17:52:21 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  was_relative  =  BLI_path_is_rel ( filepath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ListBase  frame_ranges_all ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-17 15:57:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BLI_listbase_clear ( & frame_ranges_all ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										image_sequence_get_frame_ranges ( op - > ptr ,  & frame_ranges_all ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( ImageFrameRange  * frame_range  =  frame_ranges_all . first ;  frame_range ;  frame_range  =  frame_range - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  frame_range_ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  frame_range_seq_len  =  image_sequence_get_len ( & frame_range - > frames ,  & frame_range_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_freelistN ( & frame_range - > frames ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-17 15:57:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											char  filepath_range [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_strncpy ( filepath_range ,  frame_range - > filepath ,  sizeof ( filepath_range ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-17 15:57:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( was_relative )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-05 15:10:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												BLI_path_rel ( filepath_range ,  BKE_main_blendfile_path ( bmain ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-06-17 15:57:00 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Image  * ima_range  =  image_open_single ( 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											         bmain ,  op ,  filepath_range ,  BKE_main_blendfile_path ( bmain ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											         is_relative_path ,  use_multiview ,  frame_range_seq_len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* take the first image */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( ima  = =  NULL )  & &  ima_range )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ima  =  ima_range ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												frame_seq_len  =  frame_range_seq_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												frame_ofs  =  frame_range_ofs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BLI_freelistN ( & frame_ranges_all ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* for drag & drop etc. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ima  =  image_open_single ( 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										        bmain ,  op ,  filepath ,  BKE_main_blendfile_path ( bmain ) , 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										        is_relative_path ,  use_multiview ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 16:02:46 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-25 11:06:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* hook into UI */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									iod  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( iod - > pprop . prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* when creating new ID blocks, use is already 1, but RNA
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 07:14:47 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										 *  pointer  use  also  increases  user ,  so  this  compensates  it  */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-09 19:47:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										id_us_min ( & ima - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 07:14:47 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_id_pointer_create ( & ima - > id ,  & idptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_property_pointer_set ( & iod - > pprop . ptr ,  iod - > pprop . prop ,  idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RNA_property_update ( C ,  & iod - > pprop . ptr ,  iod - > pprop . prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( iod - > iuser )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										iuser  =  iod - > iuser ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-12 16:05:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if  ( sa  & &  sa - > spacetype  = =  SPACE_IMAGE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-06 00:04:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  sa - > spacedata . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_set ( bmain ,  sima ,  scene ,  obedit ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										iuser  =  & sima - > iuser ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-08 19:03:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-12 16:05:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if  ( sa  & &  sa - > spacetype  = =  SPACE_VIEW3D )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-06 00:04:15 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										View3D  * v3d  =  sa - > spacedata . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( BGpic  * bgpic  =  v3d - > bgpicbase . first ;  bgpic ;  bgpic  =  bgpic - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( bgpic - > ima  = =  ima )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												iuser  =  & bgpic - > iuser ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-08 19:03:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Tex  * tex  =  CTX_data_pointer_get_type ( C ,  " texture " ,  & RNA_Texture ) . data ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( tex  & &  tex - > type  = =  TEX_IMAGE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											iuser  =  & tex - > iuser ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-08 19:03:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-08 19:03:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* initialize because of new image */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( iuser )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										iuser - > frames  =  frame_seq_len ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										iuser - > sfra  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-20 18:54:03 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										iuser - > framenr  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-10 14:22:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ima - > source  = =  IMA_SRC_MOVIE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											iuser - > offset  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-06 16:56:41 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-10 14:22:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											iuser - > offset  =  frame_ofs  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										iuser - > fie_ima  =  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										iuser - > scene  =  scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_image_init_imageuser ( ima ,  iuser ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-08 19:03:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-03 15:18:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* XXX unpackImage frees image buffers */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-18 15:51:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_preview_kill_jobs ( CTX_wm_manager ( C ) ,  bmain ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_signal ( bmain ,  ima ,  iuser ,  IMA_SIGNAL_RELOAD ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_open_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ;  /* XXX other space types can call */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-27 00:22:49 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  char  * path  =  U . textudir ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 15:44:15 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ima  =  sima - > image ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-11 03:31:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Tex  * tex  =  CTX_data_pointer_get_type ( C ,  " texture " ,  & RNA_Texture ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( tex  & &  tex - > type  = =  TEX_IMAGE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima  =  tex - > ima ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-11 03:31:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 09:04:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* hook into UI */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-09 21:20:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										UI_context_active_but_prop_get_templateID ( C ,  & ptr ,  & prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 09:04:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( prop )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											PointerRNA  oldptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-26 17:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Image  * oldima ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 09:04:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											oldptr  =  RNA_property_pointer_get ( & ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-26 17:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											oldima  =  ( Image  * ) oldptr . id . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* unlikely to fail but better avoid strange crash */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-30 17:02:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( oldima  & &  GS ( oldima - > id . name )  = =  ID_IM )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-26 17:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ima  =  oldima ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-07-25 09:04:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										path  =  ima - > name ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 16:57:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " filepath " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  image_open_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_open_init ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* show multiview save options only if scene has multiviews */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 15:44:15 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_struct_find_property ( op - > ptr ,  " show_multiview " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_property_boolean_set ( op - > ptr ,  prop ,  ( scene - > r . scemode  &  R_MULTIVIEW )  ! =  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_filesel ( C ,  op ,  path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-26 09:59:56 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_open_draw_check_prop ( PointerRNA  * UNUSED ( ptr ) ,  PropertyRNA  * prop ,  void  * UNUSED ( user_data ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  char  * prop_id  =  RNA_property_identifier ( prop ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ! ( STREQ ( prop_id ,  " filepath " )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									         STREQ ( prop_id ,  " directory " )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									         STREQ ( prop_id ,  " filename " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									         ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  image_open_draw ( bContext  * UNUSED ( C ) ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiLayout  * layout  =  op - > layout ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageOpenData  * iod  =  op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageFormatData  * imf  =  & iod - > im_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PointerRNA  imf_ptr ,  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* main draw call */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_pointer_create ( NULL ,  op - > type - > srna ,  op - > properties ,  & ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-26 09:59:56 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									uiDefAutoButsRNA ( layout ,  & ptr ,  image_open_draw_check_prop ,  NULL ,  ' \0 ' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* image template */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_pointer_create ( NULL ,  & RNA_ImageFormatSettings ,  imf ,  & imf_ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* multiview template */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( RNA_boolean_get ( op - > ptr ,  " show_multiview " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										uiTemplateImageFormatViews ( layout ,  & imf_ptr ,  op - > ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-08 19:03:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* called by other space types too */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_open ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Open Image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > description  =  " Open image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_open " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_open_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_open_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_open_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > ui  =  image_open_draw ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-07 22:56:20 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_operator_properties_filesel ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        ot ,  FILE_TYPE_FOLDER  |  FILE_TYPE_IMAGE  |  FILE_TYPE_MOVIE ,  FILE_SPECIAL ,  FILE_OPENFILE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        WM_FILESEL_FILEPATH  |  WM_FILESEL_DIRECTORY  |  WM_FILESEL_FILES  |  WM_FILESEL_RELPATH , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        FILE_DEFAULTDISPLAY ,  FILE_SORT_ALPHA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-06 14:50:10 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " use_sequence_detection " ,  true ,  " Detect Sequences " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									                " Automatically detect animated sequences in selected images (based on file names) " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** Match movie length operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  image_match_len_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_pointer_get_type ( C ,  " edit_image " ,  & RNA_Image ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageUser  * iuser  =  CTX_data_pointer_get_type ( C ,  " edit_image_user " ,  & RNA_ImageUser ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! ima  | |  ! iuser )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Try to get a Texture, or a SpaceImage from context... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Tex  * tex  =  CTX_data_pointer_get_type ( C ,  " texture " ,  & RNA_Texture ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( tex  & &  tex - > type  = =  TEX_IMAGE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima  =  tex - > ima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											iuser  =  & tex - > iuser ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( sima )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ima  =  sima - > image ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											iuser  =  & sima - > iuser ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ima  | |  ! iuser  | |  ! BKE_image_has_anim ( ima ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-12-27 15:27:38 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  anim  * anim  =  ( ( ImageAnim  * ) ima - > anims . first ) - > anim ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-23 16:51:26 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! anim ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									iuser - > frames  =  IMB_anim_get_duration ( anim ,  IMB_TC_RECORD_RUN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_user_frame_calc ( iuser ,  scene - > r . cfra ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* called by other space types too */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_match_movie_length ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name  =  " Match Movie Length " ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-17 13:56:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Set image's user's length to the one of this video " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_match_movie_length " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_match_len_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 02:44:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_INTERNAL /* | OPTYPE_UNDO */ ;  /* Don't think we need undo for that. */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-01 17:28:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** replace image operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_replace_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  str [ FILE_MAX ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! sima - > image ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-14 03:52:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_string_get ( op - > ptr ,  " filepath " ,  str ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-16 05:52:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* we cant do much if the str is longer then FILE_MAX :/ */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BLI_strncpy ( sima - > image - > name ,  str ,  sizeof ( sima - > image - > name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 12:46:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > image - > source  = =  IMA_SRC_GENERATED )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sima - > image - > source  =  IMA_SRC_FILE ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_image_signal ( bmain ,  sima - > image ,  & sima - > iuser ,  IMA_SIGNAL_SRC_CHANGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-12 12:46:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-17 16:13:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( BLI_path_extension_check_array ( str ,  imb_ext_movie ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > image - > source  =  IMA_SRC_MOVIE ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-16 04:21:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sima - > image - > source  =  IMA_SRC_FILE ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-02-16 04:21:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-03 15:18:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* XXX unpackImage frees image buffers */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-18 15:51:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_preview_kill_jobs ( CTX_wm_manager ( C ) ,  CTX_data_main ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-11 16:29:12 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_icon_changed ( BKE_icon_id_ensure ( & sima - > image - > id ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_signal ( bmain ,  sima - > image ,  & sima - > iuser ,  IMA_SIGNAL_RELOAD ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  sima - > image ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_replace_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! sima - > image ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " filepath " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  image_replace_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! RNA_struct_property_is_set ( op - > ptr ,  " relative_path " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-29 10:32:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_boolean_set ( op - > ptr ,  " relative_path " ,  BLI_path_is_rel ( sima - > image - > name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-25 12:04:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									image_filesel ( C ,  op ,  sima - > image - > name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_replace ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Replace Image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_replace " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Replace current image by another one from disk " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_replace_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_replace_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-17 12:11:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_not_packed_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-07 22:56:20 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_operator_properties_filesel ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        ot ,  FILE_TYPE_FOLDER  |  FILE_TYPE_IMAGE  |  FILE_TYPE_MOVIE ,  FILE_SPECIAL ,  FILE_OPENFILE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        WM_FILESEL_FILEPATH  |  WM_FILESEL_RELPATH ,  FILE_DEFAULTDISPLAY ,  FILE_SORT_ALPHA ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/******************** save image as operator ********************/ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								typedef  struct  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* matching scene->r settings */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									//short planes, imtype, subimtype, quality;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageFormatData  im_format ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  filepath [ FILE_MAX ] ;  /* keep absolute */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  SaveImageOptions ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  save_image_options_defaults ( SaveImageOptions  * simopts ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-24 02:01:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_imformat_defaults ( & simopts - > im_format ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									simopts - > filepath [ 0 ]  =  ' \0 ' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  char  imtype_best_depth ( ImBuf  * ibuf ,  const  char  imtype ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  char  depth_ok  =  BKE_imtype_valid_depths ( imtype ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ibuf - > rect_float )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_32 )  return  R_IMF_CHAN_DEPTH_32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_24 )  return  R_IMF_CHAN_DEPTH_24 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_16 )  return  R_IMF_CHAN_DEPTH_16 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_12 )  return  R_IMF_CHAN_DEPTH_12 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  R_IMF_CHAN_DEPTH_8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_8 )  return  R_IMF_CHAN_DEPTH_8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_12 )  return  R_IMF_CHAN_DEPTH_12 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_16 )  return  R_IMF_CHAN_DEPTH_16 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_24 )  return  R_IMF_CHAN_DEPTH_24 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth_ok  &  R_IMF_CHAN_DEPTH_32 )  return  R_IMF_CHAN_DEPTH_32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  R_IMF_CHAN_DEPTH_8 ;  /* fallback, should not get here */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  save_image_options_init ( Main  * bmain ,  SaveImageOptions  * simopts ,  SpaceImage  * sima ,  Scene  * scene , 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-14 09:57:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                                   const  bool  guess_path ,  const  bool  save_as_render ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									void  * lock ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  ED_space_image_acquire_buffer ( sima ,  & lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Image  * ima  =  sima - > image ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-28 03:52:21 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_depth_set  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ELEM ( ima - > type ,  IMA_TYPE_R_RESULT ,  IMA_TYPE_COMPOSITE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* imtype */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											simopts - > im_format  =  scene - > r . im_format ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-28 03:52:21 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											is_depth_set  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-05 13:12:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! BKE_image_is_multiview ( ima ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* In case multiview is disabled, render settings would be invalid for render result in this area. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												simopts - > im_format . stereo3d_format  =  * ima - > stereo3d_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												simopts - > im_format . views_format  =  ima - > views_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-30 23:37:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-29 09:56:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ima - > source  = =  IMA_SRC_GENERATED )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												simopts - > im_format . imtype  =  R_IMF_IMTYPE_PNG ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 13:58:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												simopts - > im_format . compress  =  ibuf - > foptions . quality ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-02 08:37:57 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												simopts - > im_format . planes  =  ibuf - > planes ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-29 09:56:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												BKE_imbuf_to_image_format ( & simopts - > im_format ,  ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-19 17:17:40 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-02 08:37:57 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* use the multiview image settings as the default */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											simopts - > im_format . stereo3d_format  =  * ima - > stereo3d_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											simopts - > im_format . views_format  =  ima - > views_format ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-19 17:17:40 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 04:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										//simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BLI_strncpy ( simopts - > filepath ,  ibuf - > name ,  sizeof ( simopts - > filepath ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* sanitize all settings */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* unlikely but just in case */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-20 01:30:29 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ELEM ( simopts - > im_format . planes ,  R_IMF_PLANES_BW ,  R_IMF_PLANES_RGB ,  R_IMF_PLANES_RGBA )  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											simopts - > im_format . planes  =  R_IMF_PLANES_RGBA ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* depth, account for float buffer and format support */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-28 03:52:21 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( is_depth_set  = =  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											simopts - > im_format . depth  =  imtype_best_depth ( ibuf ,  simopts - > im_format . imtype ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-18 07:38:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* some formats don't use quality so fallback to scenes quality */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( simopts - > im_format . quality  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											simopts - > im_format . quality  =  scene - > r . im_format . quality ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* check for empty path */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( guess_path  & &  simopts - > filepath [ 0 ]  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-11 22:13:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											const  bool  is_prev_save  =  ! STREQ ( G . ima ,  " // " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-14 09:57:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( save_as_render )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-03-11 22:13:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( is_prev_save )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													BLI_strncpy ( simopts - > filepath ,  G . ima ,  sizeof ( simopts - > filepath ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													BLI_strncpy ( simopts - > filepath ,  " //untitled " ,  sizeof ( simopts - > filepath ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-05 15:10:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													BLI_path_abs ( simopts - > filepath ,  BKE_main_blendfile_path ( bmain ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-14 09:57:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												BLI_snprintf ( simopts - > filepath ,  sizeof ( simopts - > filepath ) ,  " //%s " ,  ima - > id . name  +  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-05 15:10:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												BLI_path_abs ( simopts - > filepath ,  is_prev_save  ?  G . ima  :  BKE_main_blendfile_path ( bmain ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-14 09:57:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* color management */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_color_managed_display_settings_copy ( & simopts - > im_format . display_settings ,  & scene - > display_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_color_managed_view_settings_copy ( & simopts - > im_format . view_settings ,  & scene - > view_settings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ( ibuf  ! =  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  save_image_options_from_op ( Main  * bmain ,  SaveImageOptions  * simopts ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( op - > customdata )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_color_managed_view_settings_free ( & simopts - > im_format . view_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										simopts - > im_format  =  * ( ImageFormatData  * ) op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 16:32:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " filepath " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-30 23:37:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_string_get ( op - > ptr ,  " filepath " ,  simopts - > filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-05 15:10:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BLI_path_abs ( simopts - > filepath ,  BKE_main_blendfile_path ( bmain ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-30 23:37:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  save_image_options_to_op ( SaveImageOptions  * simopts ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( op - > customdata )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_color_managed_view_settings_free ( & ( ( ImageFormatData  * ) op - > customdata ) - > view_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										* ( ImageFormatData  * ) op - > customdata  =  simopts - > im_format ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-26 01:32:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_string_set ( op - > ptr ,  " filepath " ,  simopts - > filepath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 12:32:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  save_image_post ( 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        Main  * bmain ,  wmOperator  * op ,  ImBuf  * ibuf ,  Image  * ima ,  int  ok ,  int  save_copy , 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 12:32:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        const  char  * relbase ,  int  relative ,  int  do_newpath ,  const  char  * filepath ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ok )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! save_copy )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-20 15:33:30 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ColorManagedColorspaceSettings  old_colorspace_settings ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( do_newpath )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												BLI_strncpy ( ibuf - > name ,  filepath ,  sizeof ( ibuf - > name ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												BLI_strncpy ( ima - > name ,  filepath ,  sizeof ( ima - > name ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ibuf - > userflags  & =  ~ IB_BITMAPDIRTY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* change type? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ima - > type  = =  IMA_TYPE_R_RESULT )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ima - > type  =  IMA_TYPE_IMAGE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* workaround to ensure the render result buffer is no longer used
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 *  by  this  image ,  otherwise  can  crash  when  a  new  render  result  is 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 *  created .  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ibuf - > rect  & &  ! ( ibuf - > mall  &  IB_rect ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													imb_freerectImBuf ( ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ibuf - > rect_float  & &  ! ( ibuf - > mall  &  IB_rectfloat ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													imb_freerectfloatImBuf ( ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ibuf - > zbuf  & &  ! ( ibuf - > mall  &  IB_zbuf ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													IMB_freezbufImBuf ( ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ibuf - > zbuf_float  & &  ! ( ibuf - > mall  &  IB_zbuffloat ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													IMB_freezbuffloatImBuf ( ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ELEM ( ima - > source ,  IMA_SRC_GENERATED ,  IMA_SRC_VIEWER ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ima - > source  =  IMA_SRC_FILE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ima - > type  =  IMA_TYPE_IMAGE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* only image path, never ibuf */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( relative )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												BLI_path_rel ( ima - > name ,  relbase ) ;  /* only after saving */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-05-20 15:33:30 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BKE_color_managed_colorspace_settings_copy ( & old_colorspace_settings , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											                                           & ima - > colorspace_settings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											IMB_colormanagment_colorspace_from_ibuf_ftype ( & ima - > colorspace_settings ,  ibuf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-20 15:33:30 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! BKE_color_managed_colorspace_settings_equals ( & old_colorspace_settings , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											                                                  & ima - > colorspace_settings ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												BKE_image_signal ( bmain ,  ima ,  NULL ,  IMA_SIGNAL_COLORMANAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-05-20 15:33:30 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 12:32:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_reportf ( op - > reports ,  RPT_ERROR ,  " Could not write image: %s " ,  strerror ( errno ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  save_imbuf_post ( ImBuf  * ibuf ,  ImBuf  * colormanaged_ibuf ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( colormanaged_ibuf  ! =  ibuf )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* This guys might be modified by image buffer write functions,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  need  to  copy  them  back  from  color  managed  image  buffer  to  an 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  original  one ,  so  file  type  of  image  is  being  properly  updated . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ibuf - > ftype  =  colormanaged_ibuf - > ftype ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-07-13 13:58:17 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ibuf - > foptions  =  colormanaged_ibuf - > foptions ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ibuf - > planes  =  colormanaged_ibuf - > planes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										IMB_freeImBuf ( colormanaged_ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 21:39:42 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/**
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  \ return  success . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  \ note  ` ` ima - > name ` `  and  ` ` ibuf - > name ` `  should  end  up  the  same . 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  \ note  for  multiview  the  first  ` ` ibuf ` `  is  important  to  get  the  settings . 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 21:39:42 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  bool  save_image_doit ( bContext  * C ,  SpaceImage  * sima ,  wmOperator  * op ,  SaveImageOptions  * simopts ,  bool  do_newpath ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  ED_space_image ( sima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									void  * lock ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  ED_space_image_acquire_buffer ( sima ,  & lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RenderResult  * rr  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 21:39:42 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  ok  =  false ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_wait ( 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-09 16:57:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImBuf  * colormanaged_ibuf  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  char  * relbase  =  ID_BLEND_PATH ( CTX_data_main ( C ) ,  & ima - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  bool  relative  =  ( RNA_struct_find_property ( op - > ptr ,  " relative_path " )  & &  RNA_boolean_get ( op - > ptr ,  " relative_path " ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  bool  save_copy  =  ( RNA_struct_find_property ( op - > ptr ,  " copy " )  & &  RNA_boolean_get ( op - > ptr ,  " copy " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-05 17:13:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  bool  save_as_render  =  ( RNA_struct_find_property ( op - > ptr ,  " save_as_render " )  & &  RNA_boolean_get ( op - > ptr ,  " save_as_render " ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-24 11:56:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImageFormatData  * imf  =  & simopts - > im_format ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-21 19:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-05 16:32:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* old global to ensure a 2nd save goes to same dir */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BLI_strncpy ( G . ima ,  simopts - > filepath ,  sizeof ( G . ima ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 18:07:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ima - > type  = =  IMA_TYPE_R_RESULT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 18:07:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* enforce user setting for RGB or RGBA, but skip BW */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( simopts - > im_format . planes  = =  R_IMF_PLANES_RGBA )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ibuf - > planes  =  R_IMF_PLANES_RGBA ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 18:07:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  if  ( simopts - > im_format . planes  = =  R_IMF_PLANES_RGB )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ibuf - > planes  =  R_IMF_PLANES_RGB ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 18:07:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 23:38:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* TODO, better solution, if a 24bit image is painted onto it may contain alpha */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-13 12:39:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ( simopts - > im_format . planes  = =  R_IMF_PLANES_RGBA )  & & 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-17 12:18:40 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											    /* it has been painted onto */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											    ( ibuf - > userflags  &  IB_BITMAPDIRTY ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 23:38:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												/* checks each pixel, not ideal */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-13 12:39:36 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ibuf - > planes  =  BKE_imbuf_alpha_test ( ibuf )  ?  R_IMF_PLANES_RGBA  :  R_IMF_PLANES_RGB ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 23:38:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* we need renderresult for exr and rendered multiview */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rr  =  BKE_image_acquire_renderresult ( scene ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-03 17:05:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_mono  =  rr  ?  BLI_listbase_count_at_most ( & rr - > views ,  2 )  <  2  :  BLI_listbase_count_at_most ( & ima - > views ,  2 )  <  2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-01-24 15:55:54 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_exr_rr  =  rr  & &  ELEM ( imf - > imtype ,  R_IMF_IMTYPE_OPENEXR ,  R_IMF_IMTYPE_MULTILAYER )  & &  RE_HasFloatPixels ( rr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-06 17:32:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bool  is_multilayer  =  is_exr_rr  & &  ( imf - > imtype  = =  R_IMF_IMTYPE_MULTILAYER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  layer  =  ( is_multilayer )  ?  - 1  :  sima - > iuser . layer ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* error handling */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! rr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( imf - > imtype  = =  R_IMF_IMTYPE_MULTILAYER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												BKE_report ( op - > reports ,  RPT_ERROR ,  " Did not write, no Multilayer Image " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												goto  cleanup ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-16 13:08:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 20:19:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( imf - > views_format  = =  R_IMF_VIEWS_STEREO_3D )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-11 01:14:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( ! BKE_image_is_stereo ( ima ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													BKE_reportf ( op - > reports ,  RPT_ERROR ,  " Did not write, the image doesn't have a  \" %s \"  and  \" %s \"  views " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													           STEREO_LEFT_NAME ,  STEREO_RIGHT_NAME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													goto  cleanup ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-06 13:28:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-21 19:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												/* it shouldn't ever happen*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ( BLI_findstring ( & rr - > views ,  STEREO_LEFT_NAME ,  offsetof ( RenderView ,  name ) )  = =  NULL )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												    ( BLI_findstring ( & rr - > views ,  STEREO_RIGHT_NAME ,  offsetof ( RenderView ,  name ) )  = =  NULL ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													BKE_reportf ( op - > reports ,  RPT_ERROR ,  " Did not write, the image doesn't have a  \" %s \"  and  \" %s \"  views " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													           STEREO_LEFT_NAME ,  STEREO_RIGHT_NAME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													goto  cleanup ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-21 19:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-21 18:33:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BKE_imbuf_stamp_info ( rr ,  ibuf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* fancy multiview OpenEXR */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-20 15:18:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( imf - > views_format  = =  R_IMF_VIEWS_MULTIVIEW  & &  is_exr_rr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* save render result */ 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-06 17:32:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ok  =  RE_WriteRenderResult ( op - > reports ,  rr ,  simopts - > filepath ,  imf ,  NULL ,  layer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											save_image_post ( bmain ,  op ,  ibuf ,  ima ,  ok ,  true ,  relbase ,  relative ,  do_newpath ,  simopts - > filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* regular mono pipeline */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( is_mono )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-20 15:18:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( is_exr_rr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-06 17:32:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ok  =  RE_WriteRenderResult ( op - > reports ,  rr ,  simopts - > filepath ,  imf ,  NULL ,  layer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												colormanaged_ibuf  =  IMB_colormanagement_imbuf_for_write ( ibuf ,  save_as_render ,  true ,  & imf - > view_settings ,  & imf - > display_settings ,  imf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ok  =  BKE_imbuf_write_as ( colormanaged_ibuf ,  simopts - > filepath ,  imf ,  save_copy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												save_imbuf_post ( ibuf ,  colormanaged_ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											save_image_post ( bmain ,  op ,  ibuf ,  ima ,  ok ,  ( is_exr_rr  ?  true  :  save_copy ) ,  relbase ,  relative ,  do_newpath ,  simopts - > filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* individual multiview images */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( imf - > views_format  = =  R_IMF_VIEWS_INDIVIDUAL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-24 01:01:10 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											int  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											unsigned  char  planes  =  ibuf - > planes ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-24 01:01:10 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											const  int  totviews  =  ( rr  ?  BLI_listbase_count ( & rr - > views )  :  BLI_listbase_count ( & ima - > views ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-20 15:18:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! is_exr_rr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( i  =  0 ;  i  <  totviews ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												char  filepath [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												bool  ok_view  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  char  * view  =  rr  ?  ( ( RenderView  * )  BLI_findlink ( & rr - > views ,  i ) ) - > name  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												                        ( ( ImageView  * )  BLI_findlink ( & ima - > views ,  i ) ) - > name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-20 15:18:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( is_exr_rr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													BKE_scene_multiview_view_filepath_get ( & scene - > r ,  simopts - > filepath ,  view ,  filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-06 17:32:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													ok_view  =  RE_WriteRenderResult ( op - > reports ,  rr ,  filepath ,  imf ,  view ,  layer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													save_image_post ( bmain ,  op ,  ibuf ,  ima ,  ok_view ,  true ,  relbase ,  relative ,  do_newpath ,  filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-21 19:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* copy iuser to get the correct ibuf for this view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ImageUser  iuser  =  sima - > iuser ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													iuser . view  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													iuser . flag  & =  ~ IMA_SHOW_STEREO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-17 09:48:31 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( rr ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														BKE_image_multilayer_index ( rr ,  & iuser ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-17 09:48:31 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													else 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														BKE_image_multiview_index ( ima ,  & iuser ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ibuf  =  BKE_image_acquire_ibuf ( sima - > image ,  & iuser ,  & lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ibuf - > planes  =  planes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													BKE_scene_multiview_view_filepath_get ( & scene - > r ,  simopts - > filepath ,  view ,  filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													colormanaged_ibuf  =  IMB_colormanagement_imbuf_for_write ( ibuf ,  save_as_render ,  true ,  & imf - > view_settings ,  & imf - > display_settings ,  imf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ok_view  =  BKE_imbuf_write_as ( colormanaged_ibuf ,  filepath ,  & simopts - > im_format ,  save_copy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													save_imbuf_post ( ibuf ,  colormanaged_ibuf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													save_image_post ( bmain ,  op ,  ibuf ,  ima ,  ok_view ,  true ,  relbase ,  relative ,  do_newpath ,  filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													BKE_image_release_ibuf ( sima - > image ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 04:05:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ok  & =  ok_view ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-20 15:18:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( is_exr_rr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-21 19:14:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-16 13:08:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* stereo (multiview) images */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( simopts - > im_format . views_format  = =  R_IMF_VIEWS_STEREO_3D )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( imf - > imtype  = =  R_IMF_IMTYPE_MULTILAYER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-06 17:32:05 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ok  =  RE_WriteRenderResult ( op - > reports ,  rr ,  simopts - > filepath ,  imf ,  NULL ,  layer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												save_image_post ( bmain ,  op ,  ibuf ,  ima ,  ok ,  true ,  relbase ,  relative ,  do_newpath ,  simopts - > filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ImBuf  * ibuf_stereo [ 2 ]  =  { NULL } ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 18:07:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												unsigned  char  planes  =  ibuf - > planes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												const  char  * names [ 2 ]  =  { STEREO_LEFT_NAME ,  STEREO_RIGHT_NAME } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-30 18:07:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												/* we need to get the specific per-view buffers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  2 ;  i  + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ImageUser  iuser  =  sima - > iuser ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													iuser . flag  & =  ~ IMA_SHOW_STEREO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( rr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														int  id  =  BLI_findstringindex ( & rr - > views ,  names [ i ] ,  offsetof ( RenderView ,  name ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														iuser . view  =  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														BKE_image_multilayer_index ( rr ,  & iuser ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														iuser . view  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														BKE_image_multiview_index ( ima ,  & iuser ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ibuf  =  BKE_image_acquire_ibuf ( sima - > image ,  & iuser ,  & lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( ibuf  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														BKE_report ( op - > reports ,  RPT_ERROR ,  " Did not write, unexpected error when saving stereo image " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														goto  cleanup ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													ibuf - > planes  =  planes ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													/* color manage the ImBuf leaving it ready for saving */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													colormanaged_ibuf  =  IMB_colormanagement_imbuf_for_write ( ibuf ,  save_as_render ,  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													                                                        & imf - > view_settings ,  & imf - > display_settings ,  imf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-19 17:17:40 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													BKE_imbuf_write_prepare ( colormanaged_ibuf ,  imf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													IMB_prepare_write_ImBuf ( IMB_isfloat ( colormanaged_ibuf ) ,  colormanaged_ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* duplicate buffer to prevent locker issue when using render result */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ibuf_stereo [ i ]  =  IMB_dupImBuf ( colormanaged_ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													save_imbuf_post ( ibuf ,  colormanaged_ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													BKE_image_release_ibuf ( sima - > image ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ibuf  =  IMB_stereo3d_ImBuf ( imf ,  ibuf_stereo [ 0 ] ,  ibuf_stereo [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* save via traditional path */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												ok  =  BKE_imbuf_write_as ( ibuf ,  simopts - > filepath ,  imf ,  save_copy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												IMB_freeImBuf ( ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  2 ;  i  + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													IMB_freeImBuf ( ibuf_stereo [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-19 17:17:40 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  sima - > image ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								cleanup : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( rr )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_image_release_renderresult ( scene ,  ima ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_cursor_wait ( 0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 21:39:42 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ok ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_save_as_free ( wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( op - > customdata )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ImageFormatData  * im_format  =  ( ImageFormatData  * ) op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_color_managed_view_settings_free ( & im_format - > view_settings ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										op - > customdata  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_save_as_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SaveImageOptions  simopts ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_options_defaults ( & simopts ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-09 00:41:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* just in case to initialize values,
 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									 *  these  should  be  set  on  invoke  or  by  the  caller .  */ 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_options_init ( bmain ,  & simopts ,  sima ,  CTX_data_scene ( C ) ,  false ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_options_from_op ( bmain ,  & simopts ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-24 21:27:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_doit ( C ,  sima ,  op ,  & simopts ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_save_as_free ( op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-17 09:27:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-06-18 15:30:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_save_as_check ( bContext  * UNUSED ( C ) ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-17 09:27:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageFormatData  * imf  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-23 13:57:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  WM_operator_filesel_ensure_ext_imtype ( op ,  imf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-17 09:27:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_save_as_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  ED_space_image ( sima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SaveImageOptions  simopts ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-14 09:57:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  save_as_render  =  ( ( ima - > source  = =  IMA_SRC_VIEWER )  | |  ( ima - > flag  &  IMA_VIEW_AS_RENDER ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " filepath " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  image_save_as_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-05-06 16:37:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-04-13 09:20:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_options_defaults ( & simopts ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( save_image_options_init ( bmain ,  & simopts ,  sima ,  scene ,  true ,  save_as_render )  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									save_image_options_to_op ( & simopts ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* enable save_copy by default for render results */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ELEM ( ima - > type ,  IMA_TYPE_R_RESULT ,  IMA_TYPE_COMPOSITE )  & &  ! RNA_struct_property_is_set ( op - > ptr ,  " copy " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_boolean_set ( op - > ptr ,  " copy " ,  true ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-14 09:57:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_boolean_set ( op - > ptr ,  " save_as_render " ,  save_as_render ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									op - > customdata  =  MEM_mallocN ( sizeof ( simopts . im_format ) ,  __func__ ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									memcpy ( op - > customdata ,  & simopts . im_format ,  sizeof ( simopts . im_format ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* show multiview save options only if image has multiviews */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									prop  =  RNA_struct_find_property ( op - > ptr ,  " show_multiview " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-11 01:14:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_property_boolean_set ( op - > ptr ,  prop ,  BKE_image_is_multiview ( ima ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_struct_find_property ( op - > ptr ,  " use_multiview " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-11 01:14:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_property_boolean_set ( op - > ptr ,  prop ,  BKE_image_is_multiview ( ima ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_filesel ( C ,  op ,  simopts . filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_save_as_cancel ( bContext  * UNUSED ( C ) ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 20:19:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_save_as_free ( op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-26 09:59:56 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_save_as_draw_check_prop ( PointerRNA  * ptr ,  PropertyRNA  * prop ,  void  * UNUSED ( user_data ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  char  * prop_id  =  RNA_property_identifier ( prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-19 23:17:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  ! ( STREQ ( prop_id ,  " filepath " )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									         STREQ ( prop_id ,  " directory " )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									         STREQ ( prop_id ,  " filename " )  | | 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									         /* when saving a copy, relative path has no effect */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-19 23:17:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									         ( ( STREQ ( prop_id ,  " relative_path " ) )  & &  RNA_boolean_get ( ptr ,  " copy " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									         ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  image_save_as_draw ( bContext  * UNUSED ( C ) ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									uiLayout  * layout  =  op - > layout ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageFormatData  * imf  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PointerRNA  imf_ptr ,  ptr ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-22 21:50:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  is_multiview  =  RNA_boolean_get ( op - > ptr ,  " show_multiview " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 20:19:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* image template */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_pointer_create ( NULL ,  & RNA_ImageFormatSettings ,  imf ,  & imf_ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiTemplateImageSettings ( layout ,  & imf_ptr ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 20:19:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* main draw call */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_pointer_create ( NULL ,  op - > type - > srna ,  op - > properties ,  & ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-26 09:59:56 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									uiDefAutoButsRNA ( layout ,  & ptr ,  image_save_as_draw_check_prop ,  NULL ,  ' \0 ' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* multiview template */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( is_multiview ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-22 21:50:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										uiTemplateImageFormatViews ( layout ,  & imf_ptr ,  op - > ptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 20:19:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_save_as_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-28 01:16:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( space_image_buffer_exists_poll ( C ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( G . is_rendering )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* no need to NULL check here */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Image  * ima  =  ED_space_image ( sima ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-09-30 10:39:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ima - > source  = =  IMA_SRC_VIEWER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-28 01:16:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												CTX_wm_operator_poll_msg_set ( C ,  " can't save image while rendering " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-28 01:16:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-28 01:16:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-28 01:16:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_save_as ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Save As Image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_save_as " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Save the image with another name and/or settings " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_save_as_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > check  =  image_save_as_check ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_save_as_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_save_as_cancel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > ui  =  image_save_as_draw ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-28 01:16:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_save_as_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " save_as_render " ,  0 ,  " Save As Render " ,  " Apply render part of display transform when saving byte image " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-11-21 23:56:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " copy " ,  0 ,  " Copy " ,  " Create a new image file without modifying the current image in blender " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-02-07 22:56:20 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_operator_properties_filesel ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        ot ,  FILE_TYPE_FOLDER  |  FILE_TYPE_IMAGE  |  FILE_TYPE_MOVIE ,  FILE_SPECIAL ,  FILE_SAVE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									        WM_FILESEL_FILEPATH  |  WM_FILESEL_RELPATH ,  FILE_DEFAULTDISPLAY ,  FILE_SORT_ALPHA ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** save image operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_save_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-24 00:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SaveImageOptions  simopts ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-12-23 13:57:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_options_defaults ( & simopts ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( save_image_options_init ( bmain ,  & simopts ,  sima ,  scene ,  false ,  false )  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									save_image_options_from_op ( bmain ,  & simopts ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-22 15:35:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( BLI_exists ( simopts . filepath )  & &  BLI_file_is_writable ( simopts . filepath ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-30 21:39:42 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( save_image_doit ( C ,  sima ,  op ,  & simopts ,  false ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* report since this can be called from key-shortcuts */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BKE_reportf ( op - > reports ,  RPT_INFO ,  " Saved Image '%s' " ,  simopts . filepath ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 17:32:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_reportf ( op - > reports ,  RPT_ERROR ,  " Cannot save image, path '%s' is not writable " ,  simopts . filepath ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 18:08:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_save ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Save Image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_save " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Save the image with current name and settings " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_save_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_file_exists_poll ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************* save sequence operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_save_sequence_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf ,  * first_ibuf  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  tot  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-05 06:26:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  di [ FILE_MAX ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  MovieCacheIter  * iter ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > image  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > image - > source  ! =  IMA_SRC_SEQUENCE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Can only save sequence on image sequences " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > image - > type  = =  IMA_TYPE_MULTILAYER )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 17:32:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Cannot save multilayer sequences " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* get total dirty buffers and first dirty buffer which is used for menu */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ibuf  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( sima - > image - > cache  ! =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										iter  =  IMB_moviecacheIter_new ( sima - > image - > cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										while  ( ! IMB_moviecacheIter_done ( iter ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ibuf  =  IMB_moviecacheIter_getImBuf ( iter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ibuf - > userflags  &  IB_BITMAPDIRTY )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( first_ibuf  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													first_ibuf  =  ibuf ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												tot + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											IMB_moviecacheIter_step ( iter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										IMB_moviecacheIter_free ( iter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( tot  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_WARNING ,  " No images have been changed " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* get a filename for menu */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BLI_split_dir_part ( first_ibuf - > name ,  di ,  sizeof ( di ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-14 15:29:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_reportf ( op - > reports ,  RPT_INFO ,  " %d image(s) will be saved in %s " ,  tot ,  di ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									iter  =  IMB_moviecacheIter_new ( sima - > image - > cache ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( ! IMB_moviecacheIter_done ( iter ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ibuf  =  IMB_moviecacheIter_getImBuf ( iter ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf - > userflags  &  IB_BITMAPDIRTY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											char  name [ FILE_MAX ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BLI_strncpy ( name ,  ibuf - > name ,  sizeof ( name ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-05 15:10:33 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BLI_path_abs ( name ,  BKE_main_blendfile_path ( bmain ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( 0  = =  IMB_saveiff ( ibuf ,  name ,  IB_rect  |  IB_zbuf  |  IB_zbuffloat ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-11 12:32:29 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												BKE_reportf ( op - > reports ,  RPT_ERROR ,  " Could not write image: %s " ,  strerror ( errno ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 17:32:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											BKE_reportf ( op - > reports ,  RPT_INFO ,  " Saved %s " ,  ibuf - > name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ibuf - > userflags  & =  ~ IB_BITMAPDIRTY ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										IMB_moviecacheIter_step ( iter ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 16:22:08 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									IMB_moviecacheIter_free ( iter ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_save_sequence ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Save Sequence " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_save_sequence " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Save a sequence of images " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_save_sequence_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_buffer_exists_poll ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** reload image operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_reload_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ima ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-03 15:18:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* XXX unpackImage frees image buffers */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-18 15:51:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_preview_kill_jobs ( CTX_wm_manager ( C ) ,  CTX_data_main ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-09 22:00:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// XXX other users?
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_signal ( bmain ,  ima ,  ( sima )  ?  & sima - > iuser  :  NULL ,  IMA_SIGNAL_RELOAD ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-18 19:28:33 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DAG_id_tag_update ( & ima - > id ,  0 ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_reload ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Reload Image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_reload " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Reload current image from disk " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_reload_exec ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER ;  /* no undo, image buffer is not handled by undo */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************** new image operator *********************/ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 14:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# define IMA_DEF_NAME N_("Untitled") 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								enum  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									GEN_CONTEXT_NONE  =  0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									GEN_CONTEXT_PAINT_CANVAS  =  1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									GEN_CONTEXT_PAINT_STENCIL  =  2 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-28 12:38:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_new_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Object  * obedit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Image  * ima ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-05 12:46:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PointerRNA  ptr ,  idptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-04 16:44:45 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  name_buffer [ MAX_ID_NAME  -  2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  char  * name ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  color [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-29 08:17:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  width ,  height ,  floatbuf ,  gen_type ,  alpha ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  gen_context ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  stereo3d ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* retrieve state */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									obedit  =  CTX_data_edit_object ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-05 12:46:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 14:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_struct_find_property ( op - > ptr ,  " name " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-04 16:44:45 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_property_string_get ( op - > ptr ,  prop ,  name_buffer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 14:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! RNA_property_is_set ( op - > ptr ,  prop ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Default value, we can translate! */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-04 16:44:45 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										name  =  DATA_ ( name_buffer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										name  =  name_buffer ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 14:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									width  =  RNA_int_get ( op - > ptr ,  " width " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									height  =  RNA_int_get ( op - > ptr ,  " height " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									floatbuf  =  RNA_boolean_get ( op - > ptr ,  " float " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-29 08:17:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									gen_type  =  RNA_enum_get ( op - > ptr ,  " generated_type " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_float_get_array ( op - > ptr ,  " color " ,  color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									alpha  =  RNA_boolean_get ( op - > ptr ,  " alpha " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									gen_context  =  RNA_enum_get ( op - > ptr ,  " gen_context " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									stereo3d  =  RNA_boolean_get ( op - > ptr ,  " use_stereo_3d " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-22 21:05:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! alpha ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										color [ 3 ]  =  1.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-29 22:07:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ima  =  BKE_image_add_generated ( bmain ,  width ,  height ,  name ,  alpha  ?  32  :  24 ,  floatbuf ,  gen_type ,  color ,  stereo3d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 19:27:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ima ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* hook into UI */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-09 21:20:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									UI_context_active_but_prop_get_templateID ( C ,  & ptr ,  & prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( prop )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* when creating new ID blocks, use is already 1, but RNA
 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-21 07:14:47 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										 *  pointer  use  also  increases  user ,  so  this  compensates  it  */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-09 19:47:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										id_us_min ( & ima - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RNA_id_pointer_create ( & ima - > id ,  & idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RNA_property_pointer_set ( & ptr ,  prop ,  idptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RNA_property_update ( C ,  & ptr ,  prop ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-16 19:27:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-25 16:58:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if  ( sima )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_set ( bmain ,  sima ,  scene ,  obedit ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-25 16:58:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if  ( gen_context  = =  GEN_CONTEXT_PAINT_CANVAS )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bScreen  * sc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Object  * ob  =  CTX_data_active_object ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										GPU_drawobject_free ( ob - > derivedFinal ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( scene - > toolsettings - > imapaint . canvas ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											id_us_min ( & scene - > toolsettings - > imapaint . canvas - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scene - > toolsettings - > imapaint . canvas  =  ima ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( sc  =  bmain - > screen . first ;  sc ;  sc  =  sc - > id . next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ScrArea  * sa ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( sa  =  sc - > areabase . first ;  sa ;  sa  =  sa - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												SpaceLink  * sl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( sl  =  sa - > spacedata . first ;  sl ;  sl  =  sl - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( sl - > spacetype  = =  SPACE_IMAGE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 15:44:15 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														SpaceImage  * sima_other  =  ( SpaceImage  * ) sl ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 15:44:15 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														if  ( ! sima_other - > pin )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															ED_space_image_set ( bmain ,  sima_other ,  scene ,  scene - > obedit ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 15:44:15 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_paint_proj_mesh_data_check ( scene ,  ob ,  NULL ,  NULL ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										WM_event_add_notifier ( C ,  NC_SCENE  |  ND_TOOLSETTINGS ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( gen_context  = =  GEN_CONTEXT_PAINT_STENCIL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Object  * ob  =  CTX_data_active_object ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( scene - > toolsettings - > imapaint . stencil ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											id_us_min ( & scene - > toolsettings - > imapaint . stencil - > id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scene - > toolsettings - > imapaint . stencil  =  ima ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_paint_proj_mesh_data_check ( scene ,  ob ,  NULL ,  NULL ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										WM_event_add_notifier ( C ,  NC_SCENE  |  ND_TOOLSETTINGS ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-25 16:58:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Tex  * tex  =  CTX_data_pointer_get_type ( C ,  " texture " ,  & RNA_Texture ) . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( tex  & &  tex - > type  = =  TEX_IMAGE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-24 13:54:47 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( tex - > ima ) 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-25 21:44:19 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												id_us_min ( & tex - > ima - > id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-25 11:00:55 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											tex - > ima  =  ima ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-25 16:58:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-01 23:32:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_signal ( bmain ,  ima ,  ( sima )  ?  & sima - > iuser  :  NULL ,  IMA_SIGNAL_USER_NEW_IMAGE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-30 22:53:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_ADDED ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-11-28 12:38:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* XXX, Ton is not a fan of OK buttons but using this function to avoid undo/redo bug while in mesh-editmode, - campbell */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-09 21:20:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* XXX Note: the WM_operator_props_dialog_popup() doesn't work for UI_context_active_but_prop_get_templateID(), image is not being that way */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_new_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-20 17:31:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 14:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* Better for user feedback. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_string_set ( op - > ptr ,  " name " ,  DATA_ ( IMA_DEF_NAME ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-19 02:30:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  WM_operator_props_dialog_popup ( C ,  op ,  15  *  UI_UNIT_X ,  5  *  UI_UNIT_Y ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-20 17:31:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_new_draw ( bContext  * UNUSED ( C ) ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiLayout  * split ,  * col [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiLayout  * layout  =  op - > layout ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									PointerRNA  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  bool  is_multiview  =  ( scene - > r . scemode  &  R_MULTIVIEW )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_pointer_create ( NULL ,  op - > type - > srna ,  op - > properties ,  & ptr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* copy of WM_operator_props_dialog_popup() layout */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									split  =  uiLayoutSplit ( layout ,  0.5f ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									col [ 0 ]  =  uiLayoutColumn ( split ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									col [ 1 ]  =  uiLayoutColumn ( split ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  IFACE_ ( " Name " ) ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " name " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  IFACE_ ( " Width " ) ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " width " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  IFACE_ ( " Height " ) ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " height " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  IFACE_ ( " Color " ) ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " color " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " alpha " ,  0 ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  IFACE_ ( " Generated Type " ) ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " generated_type " ,  0 ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemL ( col [ 0 ] ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiItemR ( col [ 1 ] ,  & ptr ,  " float " ,  0 ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( is_multiview )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										uiItemL ( col [ 0 ] ,  " " ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										uiItemR ( col [ 1 ] ,  & ptr ,  " use_stereo_3d " ,  0 ,  NULL ,  ICON_NONE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_new ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-29 22:07:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									static  float  default_color [ 4 ]  =  { 0.0f ,  0.0f ,  0.0f ,  1.0f } ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-18 15:07:26 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									static  const  EnumPropertyItem  gen_context_items [ ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										{ GEN_CONTEXT_NONE ,  " NONE " ,  0 ,  " None " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ GEN_CONTEXT_PAINT_CANVAS ,  " PAINT_CANVAS " ,  0 ,  " Paint Canvas " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-21 09:05:52 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										{ GEN_CONTEXT_PAINT_STENCIL ,  " PAINT_STENCIL " ,  0 ,  " Paint Stencil " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										{ 0 ,  NULL ,  0 ,  NULL ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " New Image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > description  =  " Create a new image " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_new " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_new_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_new_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > ui  =  image_new_draw ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-19 16:46:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_string ( ot - > srna ,  " name " ,  IMA_DEF_NAME ,  MAX_ID_NAME  -  2 ,  " Name " ,  " Image data-block name " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-13 04:39:15 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_int ( ot - > srna ,  " width " ,  1024 ,  1 ,  INT_MAX ,  " Width " ,  " Image width " ,  1 ,  16384 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_subtype ( prop ,  PROP_PIXEL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_int ( ot - > srna ,  " height " ,  1024 ,  1 ,  INT_MAX ,  " Height " ,  " Image height " ,  1 ,  16384 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_subtype ( prop ,  PROP_PIXEL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_float_color ( ot - > srna ,  " color " ,  4 ,  NULL ,  0.0f ,  FLT_MAX ,  " Color " ,  " Default fill color " ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-04 12:14:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_property_subtype ( prop ,  PROP_COLOR_GAMMA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-29 22:07:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_property_float_array_default ( prop ,  default_color ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " alpha " ,  1 ,  " Alpha " ,  " Create an image with an alpha channel " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 13:49:52 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_enum ( ot - > srna ,  " generated_type " ,  rna_enum_image_generated_type_items ,  IMA_GENTYPE_BLANK , 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-29 08:17:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									             " Generated Type " ,  " Fill the image with a grid for UV map testing " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " float " ,  0 ,  " 32 bit Float " ,  " Create image with 32 bit floating point bit depth " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 15:12:06 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_enum ( ot - > srna ,  " gen_context " ,  gen_context_items ,  0 ,  " Gen Context " ,  " Generation context " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-07-22 21:05:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_HIDDEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_boolean ( ot - > srna ,  " use_stereo_3d " ,  0 ,  " Stereo 3D " ,  " Create an image with left and right views " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_SKIP_SAVE  |  PROP_HIDDEN ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-26 14:33:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# undef IMA_DEF_NAME 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/********************* invert operators *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_invert_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 11:00:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  BKE_image_has_ibuf ( ima ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 11:00:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  image_invert_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  BKE_image_acquire_ibuf ( ima ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* undo is supported only on image paint mode currently */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  support_undo  =  ( ( sima  ! =  NULL )  & &  ( sima - > mode  = =  SI_MODE_PAINT ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-07 22:51:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags indicate if this channel should be inverted */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  r  =  RNA_boolean_get ( op - > ptr ,  " invert_r " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  bool  g  =  RNA_boolean_get ( op - > ptr ,  " invert_g " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  bool  b  =  RNA_boolean_get ( op - > ptr ,  " invert_b " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  bool  a  =  RNA_boolean_get ( op - > ptr ,  " invert_a " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-30 13:52:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									size_t  i ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-06 23:56:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf  = =  NULL )   /* TODO: this should actually never happen, but does for render-results -> cleanup */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 11:00:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( support_undo )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-23 07:51:56 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_image_undo_push_begin ( op - > type - > name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  but  better  do  this  right  in  case  someone  copies  this  for  a  tool  that  uses  partial  redraw  better  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ED_imapaint_clear_partial_redraw ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-30 13:52:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_imapaint_dirty_region ( ima ,  ibuf ,  0 ,  0 ,  ibuf - > x ,  ibuf - > y ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* TODO: make this into an IMB_invert_channels(ibuf,r,g,b,a) method!? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ibuf - > rect_float )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  * fp  =  ( float  * )  ibuf - > rect_float ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-30 13:52:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( i  =  ( ( size_t ) ibuf - > x )  *  ibuf - > y ;  i  >  0 ;  i - - ,  fp  + =  4 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( r )  fp [ 0 ]  =  1.0f  -  fp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( g )  fp [ 1 ]  =  1.0f  -  fp [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( b )  fp [ 2 ]  =  1.0f  -  fp [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( a )  fp [ 3 ]  =  1.0f  -  fp [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf - > rect )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											IMB_rect_from_float ( ibuf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if  ( ibuf - > rect )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										char  * cp  =  ( char  * )  ibuf - > rect ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-30 13:52:25 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for  ( i  =  ( ( size_t ) ibuf - > x )  *  ibuf - > y ;  i  >  0 ;  i - - ,  cp  + =  4 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( r )  cp [ 0 ]  =  255  -  cp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( g )  cp [ 1 ]  =  255  -  cp [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( b )  cp [ 2 ]  =  255  -  cp [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( a )  cp [ 3 ]  =  255  -  cp [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_image_release_ibuf ( ima ,  ibuf ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-28 03:17:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-18 14:18:01 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ibuf - > userflags  | =  IB_BITMAPDIRTY  |  IB_DISPLAY_BUFFER_INVALID ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf - > mipmap [ 0 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-08 20:21:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ibuf - > userflags  | =  IB_MIPMAP_INVALID ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-03-19 14:17:59 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( support_undo )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ED_image_undo_push_end ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-12-05 22:28:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* force GPU reupload, all image is invalid */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									GPU_free_image ( ima ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BKE_image_release_ibuf ( ima ,  ibuf ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 11:00:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_invert ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-15 10:44:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									PropertyRNA  * prop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Invert Channels " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_invert " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Invert image's channels " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_invert_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_invert_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2013-07-15 10:44:17 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_boolean ( ot - > srna ,  " invert_r " ,  0 ,  " Red " ,  " Invert Red Channel " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_SKIP_SAVE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_boolean ( ot - > srna ,  " invert_g " ,  0 ,  " Green " ,  " Invert Green Channel " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_SKIP_SAVE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_boolean ( ot - > srna ,  " invert_b " ,  0 ,  " Blue " ,  " Invert Blue Channel " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_SKIP_SAVE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									prop  =  RNA_def_boolean ( ot - > srna ,  " invert_a " ,  0 ,  " Alpha " ,  " Invert Alpha Channel " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_property_flag ( prop ,  PROP_SKIP_SAVE ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 12:02:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/********************* pack operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-22 02:48:11 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_pack_test ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  as_png  =  RNA_boolean_get ( op - > ptr ,  " as_png " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ima ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! as_png  & &  BKE_image_has_packedfile ( ima ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima - > source  = =  IMA_SRC_SEQUENCE  | |  ima - > source  = =  IMA_SRC_MOVIE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Packing movies or image sequences not supported " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_pack_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  BKE_image_acquire_ibuf ( ima ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  as_png  =  RNA_boolean_get ( op - > ptr ,  " as_png " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! image_pack_test ( C ,  op ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! as_png  & &  ( ibuf  & &  ( ibuf - > userflags  &  IB_BITMAPDIRTY ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 17:32:50 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Cannot pack edited image from disk, only as internal PNG " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( as_png ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_image_memorypack ( ima ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_image_packfiles ( op - > reports ,  ima ,  ID_BLEND_PATH ( bmain ,  & ima - > id ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BKE_image_release_ibuf ( ima ,  ibuf ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_pack_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-04-22 18:39:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									uiPopupMenu  * pup ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									uiLayout  * layout ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-02-03 18:55:59 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  bool  as_png  =  RNA_boolean_get ( op - > ptr ,  " as_png " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! image_pack_test ( C ,  op ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ibuf  =  BKE_image_acquire_ibuf ( ima ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! as_png  & &  ( ibuf  & &  ( ibuf - > userflags  &  IB_BITMAPDIRTY ) ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-09 21:20:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										pup  =  UI_popup_menu_begin ( C ,  IFACE_ ( " OK " ) ,  ICON_QUESTION ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										layout  =  UI_popup_menu_layout ( pup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-24 18:04:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										uiItemBooleanO ( layout ,  IFACE_ ( " Can't pack edited image from disk, pack as internal PNG? " ) ,  ICON_NONE , 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-24 15:40:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										               op - > idname ,  " as_png " ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-09 21:20:40 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										UI_popup_menu_end ( C ,  pup ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_image_release_ibuf ( ima ,  ibuf ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-28 17:51:06 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_INTERFACE ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_release_ibuf ( ima ,  ibuf ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  image_pack_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_pack ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Pack Image " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Pack an image as embedded data into the .blend file " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_pack " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_pack_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_pack_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " as_png " ,  0 ,  " Pack As PNG " ,  " Pack image as lossless PNG " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************* unpack operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-26 14:18:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_unpack_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  method  =  RNA_enum_get ( op - > ptr ,  " method " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-06-17 07:20:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* find the suppplied image by name */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-11 16:32:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " id " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										char  imaname [ MAX_ID_NAME  -  2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-26 14:18:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RNA_string_get ( op - > ptr ,  " id " ,  imaname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-06-17 07:20:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ima  =  BLI_findstring ( & CTX_data_main ( C ) - > image ,  imaname ,  offsetof ( ID ,  name )  +  2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! ima )  ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ima  | |  ! BKE_image_has_packedfile ( ima ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima - > source  = =  IMA_SRC_SEQUENCE  | |  ima - > source  = =  IMA_SRC_MOVIE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Unpacking movies or image sequences not supported " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( G . fileflags  &  G_AUTOPACK ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_WARNING ,  " AutoPack is enabled, so image will be packed again on file save " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-03 15:18:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* XXX unpackImage frees image buffers */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-18 15:51:31 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_preview_kill_jobs ( CTX_wm_manager ( C ) ,  CTX_data_main ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 11:07:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unpackImage ( CTX_data_main ( C ) ,  op - > reports ,  ima ,  method ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_unpack_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-30 19:20:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( RNA_struct_property_is_set ( op - > ptr ,  " id " ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-26 14:18:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  image_unpack_exec ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ima  | |  ! BKE_image_has_packedfile ( ima ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima - > source  = =  IMA_SRC_SEQUENCE  | |  ima - > source  = =  IMA_SRC_MOVIE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Unpacking movies or image sequences not supported " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( G . fileflags  &  G_AUTOPACK ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_WARNING ,  " AutoPack is enabled, so image will be packed again on file save " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-26 14:18:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 10:40:12 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unpack_menu ( C ,  " IMAGE_OT_unpack " ,  ima - > id . name  +  2 ,  ima - > name ,  " textures " ,  BKE_image_has_packedfile ( ima )  ?  ( ( ImagePackedFile  * ) ima - > packedfiles . first ) - > packedfile  :  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_unpack ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Unpack Image " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Save an image packed in the .blend file to disk " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_unpack " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_unpack_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_unpack_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-23 19:40:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-23 13:49:52 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_enum ( ot - > srna ,  " method " ,  rna_enum_unpack_method_items ,  PF_USE_LOCAL ,  " Method " ,  " How to unpack " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-19 16:46:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_string ( ot - > srna ,  " id " ,  NULL ,  MAX_ID_NAME  -  2 ,  " Image Name " ,  " Image data-block name to unpack " ) ;  /* XXX, weark!, will fail with library, name collisions */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/******************** sample image operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								typedef  struct  ImageSampleInfo  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegionType  * art ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									void  * draw_handle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  x ,  y ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  channels ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-20 14:33:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unsigned  char  col [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  colf [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-18 11:34:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  linearcol [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  z ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  zf ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-01-20 14:33:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unsigned  char  * colp ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-27 00:22:49 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  float  * colfp ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  * zp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  * zfp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:19:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  draw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bool  color_manage ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  use_default_view ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								}  ImageSampleInfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_sample_draw ( const  bContext  * C ,  ARegion  * ar ,  void  * arg_info ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageSampleInfo  * info  =  arg_info ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( info - > draw )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ED_image_draw_info ( scene ,  ar ,  info - > color_manage ,  info - > use_default_view ,  info - > channels , 
							 
						 
					
						
							
								
									
										
										
										
											2013-03-18 11:34:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										                   info - > x ,  info - > y ,  info - > colp ,  info - > colfp ,  info - > linearcol ,  info - > zp ,  info - > zfp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-15 04:06:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-20 22:41:26 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* Returns color in linear space, matching ED_space_node_color_sample(). */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  ED_space_image_color_sample ( SpaceImage  * sima ,  ARegion  * ar ,  int  mval [ 2 ] ,  float  r_col [ 3 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									void  * lock ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  ED_space_image_acquire_buffer ( sima ,  & lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  fx ,  fy ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-28 03:52:21 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bool  ret  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ibuf  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  mval [ 0 ] ,  mval [ 1 ] ,  & fx ,  & fy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( fx  > =  0.0f  & &  fy  > =  0.0f  & &  fx  <  1.0f  & &  fy  <  1.0f )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-27 00:22:49 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  float  * fp ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										unsigned  char  * cp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  x  =  ( int ) ( fx  *  ibuf - > x ) ,  y  =  ( int ) ( fy  *  ibuf - > y ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										CLAMP ( x ,  0 ,  ibuf - > x  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										CLAMP ( y ,  0 ,  ibuf - > y  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ibuf - > rect_float )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fp  =  ( ibuf - > rect_float  +  ( ibuf - > channels )  *  ( y  *  ibuf - > x  +  x ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-14 13:45:09 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											copy_v3_v3 ( r_col ,  fp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ret  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ibuf - > rect )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											cp  =  ( unsigned  char  * ) ( ibuf - > rect  +  y  *  ibuf - > x  +  x ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-17 12:32:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rgb_uchar_to_float ( r_col ,  cp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-14 13:45:09 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											IMB_colormanagement_colorspace_to_scene_linear_v3 ( r_col ,  ibuf - > rect_colorspace ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ret  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-16 14:47:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_sample_apply ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									void  * lock ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  ED_space_image_acquire_buffer ( sima ,  & lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ImageSampleInfo  * info  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  fx ,  fy ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CurveMapping  * curve_mapping  =  scene - > view_settings . curve_mapping ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:19:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > draw  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-30 18:18:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-20 07:40:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  event - > mval [ 0 ] ,  event - > mval [ 1 ] ,  & fx ,  & fy ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( fx  > =  0.0f  & &  fy  > =  0.0f  & &  fx  <  1.0f  & &  fy  <  1.0f )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-27 00:22:49 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  float  * fp ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-01-20 14:33:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										unsigned  char  * cp ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										int  x  =  ( int ) ( fx  *  ibuf - > x ) ,  y  =  ( int ) ( fy  *  ibuf - > y ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Image  * image  =  ED_space_image ( sima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										CLAMP ( x ,  0 ,  ibuf - > x  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										CLAMP ( y ,  0 ,  ibuf - > y  -  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > x  =  x ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										info - > y  =  y ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:19:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > draw  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > channels  =  ibuf - > channels ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > colp  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										info - > colfp  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										info - > zp  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										info - > zfp  =  NULL ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > use_default_view  =  ( image - > flag  &  IMA_VIEW_AS_RENDER )  ?  false  :  true ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf - > rect )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											cp  =  ( unsigned  char  * ) ( ibuf - > rect  +  y  *  ibuf - > x  +  x ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > col [ 0 ]  =  cp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > col [ 1 ]  =  cp [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > col [ 2 ]  =  cp [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > col [ 3 ]  =  cp [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > colp  =  info - > col ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > colf [ 0 ]  =  ( float ) cp [ 0 ]  /  255.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > colf [ 1 ]  =  ( float ) cp [ 1 ]  /  255.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > colf [ 2 ]  =  ( float ) cp [ 2 ]  /  255.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > colf [ 3 ]  =  ( float ) cp [ 3 ]  /  255.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > colfp  =  info - > colf ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-18 11:34:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											copy_v4_v4 ( info - > linearcol ,  info - > colf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											IMB_colormanagement_colorspace_to_scene_linear_v4 ( info - > linearcol ,  false ,  ibuf - > rect_colorspace ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											info - > color_manage  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf - > rect_float )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											fp  =  ( ibuf - > rect_float  +  ( ibuf - > channels )  *  ( y  *  ibuf - > x  +  x ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:19:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ibuf - > channels  = =  4 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 0 ]  =  fp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 1 ]  =  fp [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 2 ]  =  fp [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 3 ]  =  fp [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ibuf - > channels  = =  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 0 ]  =  fp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 1 ]  =  fp [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 2 ]  =  fp [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 3 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 0 ]  =  fp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 1 ]  =  fp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 2 ]  =  fp [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colf [ 3 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											info - > colfp  =  info - > colf ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-18 11:34:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											copy_v4_v4 ( info - > linearcol ,  info - > colf ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-01 11:34:00 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											info - > color_manage  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf - > zbuf )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											info - > z  =  ibuf - > zbuf [ y  *  ibuf - > x  +  x ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > zp  =  & info - > z ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-19 06:25:54 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ibuf - > zbuf  = =  ( int  * ) ibuf - > rect )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:19:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												info - > colp  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ibuf - > zbuf_float )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											info - > zf  =  ibuf - > zbuf_float [ y  *  ibuf - > x  +  x ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											info - > zfp  =  & info - > zf ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-05-13 11:19:32 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ibuf - > zbuf_float  = =  ibuf - > rect_float )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												info - > colfp  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( curve_mapping  & &  ibuf - > channels  = =  4 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* we reuse this callback for set curves point operators */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( RNA_struct_find_property ( op - > ptr ,  " point " ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												int  point  =  RNA_enum_get ( op - > ptr ,  " point " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( point  = =  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-03 11:49:29 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													curvemapping_set_black_white ( curve_mapping ,  NULL ,  info - > linearcol ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												else  if  ( point  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-03 11:49:29 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													curvemapping_set_black_white ( curve_mapping ,  info - > linearcol ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-03 11:49:29 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												WM_event_add_notifier ( C ,  NC_WINDOW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// XXX node curve integration ..
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											ScrArea  * sa ,  * cur  =  curarea ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											node_curvemap_sample ( fp ) ;    /* sends global to node editor */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( sa  =  G . curscreen - > areabase . first ;  sa ;  sa  =  sa - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( sa - > spacetype  = =  SPACE_NODE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													areawinset ( sa - > win ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													scrarea_do_windraw ( sa ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											node_curvemap_sample ( NULL ) ;      /* clears global in node editor */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											curarea  =  cur ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-21 14:37:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										info - > draw  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-21 14:37:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_sample_exit ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageSampleInfo  * info  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_region_draw_cb_exit ( info - > art ,  info - > draw_handle ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									MEM_freeN ( info ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_sample_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImageSampleInfo  * info ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-09 20:33:19 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( event - > mval [ 1 ]  < =  16  & &  ED_space_image_show_cache ( sima ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  OPERATOR_PASS_THROUGH ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-09 20:33:19 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ED_space_image_has_buffer ( sima ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									info  =  MEM_callocN ( sizeof ( ImageSampleInfo ) ,  " ImageSampleInfo " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									info - > art  =  ar - > type ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									info - > draw_handle  =  ED_region_draw_cb_activate ( ar - > type ,  image_sample_draw ,  info ,  REGION_DRAW_POST_PIXEL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									op - > customdata  =  info ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_sample_apply ( C ,  op ,  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-18 12:43:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_modal_handler ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_sample_modal ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									switch  ( event - > type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  LEFTMOUSE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  RIGHTMOUSE :  // XXX hardcoded
 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-06 23:10:21 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( event - > val  = =  KM_RELEASE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												image_sample_exit ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  MOUSEMOVE : 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											image_sample_apply ( C ,  op ,  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_sample_cancel ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_sample_exit ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_sample ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Sample Color " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_sample " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Use mouse to sample a color in current image " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_sample_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  image_sample_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_sample_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-01 14:29:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_sample_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-11 14:51:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_BLOCKING ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** sample line operator ********************/ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_sample_line_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  x_start  =  RNA_int_get ( op - > ptr ,  " xstart " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  y_start  =  RNA_int_get ( op - > ptr ,  " ystart " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  x_end  =  RNA_int_get ( op - > ptr ,  " xend " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  y_end  =  RNA_int_get ( op - > ptr ,  " yend " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									void  * lock ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf  =  ED_space_image_acquire_buffer ( sima ,  & lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Histogram  * hist  =  & sima - > sample_line_hist ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  x1f ,  y1f ,  x2f ,  y2f ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 00:21:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* hmmmm */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ibuf - > channels  <  3 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 00:21:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 00:21:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  x_start ,  y_start ,  & x1f ,  & y1f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view ( & ar - > v2d ,  x_end ,  y_end ,  & x2f ,  & y2f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-10 12:09:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > co [ 0 ] [ 0 ]  =  x1f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > co [ 0 ] [ 1 ]  =  y1f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > co [ 1 ] [ 0 ]  =  x2f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > co [ 1 ] [ 1 ]  =  y2f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-07 09:25:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* enable line drawing */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > flag  | =  HISTO_FLAG_SAMPLELINE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_histogram_update_sample_line ( hist ,  ibuf ,  & scene - > view_settings ,  & scene - > display_settings ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-07-26 09:06:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* reset y zoom */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > ymax  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_space_image_release_buffer ( sima ,  ibuf ,  lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 00:21:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_sample_line_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-10 12:09:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Histogram  * hist  =  & sima - > sample_line_hist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hist - > flag  & =  ~ HISTO_FLAG_SAMPLELINE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ED_space_image_has_buffer ( sima ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 00:21:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  WM_gesture_straightline_invoke ( C ,  op ,  event ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_sample_line ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Sample Line " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_sample_line " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Sample a line and show it in Scope panels " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_sample_line_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  WM_gesture_straightline_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_sample_line_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > cancel  =  WM_gesture_straightline_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  0 ;  /* no undo/register since this operates on the space */ 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-04-04 00:21:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_operator_properties_gesture_straightline ( ot ,  CURSOR_EDIT ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 01:22:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** set curve point operator ********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-03-29 02:15:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_curves_point_set ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-18 15:07:26 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									static  const  EnumPropertyItem  point_items [ ]  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-16 00:52:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										{ 0 ,  " BLACK_POINT " ,  0 ,  " Black Point " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 1 ,  " WHITE_POINT " ,  0 ,  " White Point " ,  " " } , 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										{ 0 ,  NULL ,  0 ,  NULL ,  NULL } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Set Curves Point " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_curves_point_set " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-07 15:50:57 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Set black point or white point for curves " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_sample_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  image_sample_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_sample_cancel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_area_not_uv_brush_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* properties */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 12:26:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RNA_def_enum ( ot - > srna ,  " point " ,  point_items ,  0 ,  " Point " ,  " Set black point or white point for curves " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-28 22:50:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								#if 0  /* Not ported to 2.5x yet */
 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/******************** record composite operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								typedef  struct  RecordCompositeData  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									wmTimer  * timer ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  old_cfra ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  sfra ,  efra ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  RecordCompositeData ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_record_composite_apply ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RecordCompositeData  * rcd  =  op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ImBuf  * ibuf ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-08-11 21:35:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_time ( CTX_wm_window ( C ) ,  scene - > r . cfra ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-24 22:42:41 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// XXX scene->nodetree->test_break = BKE_blender_test_break;
 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-26 04:14:10 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// XXX scene->nodetree->test_break = NULL;
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_image_all_free_anim_ibufs ( scene - > r . cfra ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ntreeCompositTagAnimated ( scene - > nodetree ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Color Management, Stage 2: Switch color pipeline to use OpenColorIO
Replace old color pipeline which was supporting linear/sRGB color spaces
only with OpenColorIO-based pipeline.
This introduces two configurable color spaces:
- Input color space for images and movie clips. This space is used to convert
  images/movies from color space in which file is saved to Blender's linear
  space (for float images, byte images are not internally converted, only input
  space is stored for such images and used later).
  This setting could be found in image/clip data block settings.
- Display color space which defines space in which particular display is working.
  This settings could be found in scene's Color Management panel.
When render result is being displayed on the screen, apart from converting image
to display space, some additional conversions could happen.
This conversions are:
- View, which defines tone curve applying before display transformation.
  These are different ways to view the image on the same display device.
  For example it could be used to emulate film view on sRGB display.
- Exposure affects on image exposure before tone map is applied.
- Gamma is post-display gamma correction, could be used to match particular
  display gamma.
- RGB curves are user-defined curves which are applying before display
  transformation, could be used for different purposes.
All this settings by default are only applying on render result and does not
affect on other images. If some particular image needs to be affected by this
transformation, "View as Render" setting of image data block should be set to
truth. Movie clips are always affected by all display transformations.
This commit also introduces configurable color space in which sequencer is
working. This setting could be found in scene's Color Management panel and
it should be used if such stuff as grading needs to be done in color space
different from sRGB (i.e. when Film view on sRGB display is use, using VD16
space as sequencer's internal space would make grading working in space
which is close to the space using for display).
Some technical notes:
- Image buffer's float buffer is now always in linear space, even if it was
  created from 16bit byte images.
- Space of byte buffer is stored in image buffer's rect_colorspace property.
- Profile of image buffer was removed since it's not longer meaningful.
- OpenGL and GLSL is supposed to always work in sRGB space. It is possible
  to support other spaces, but it's quite large project which isn't so
  much important.
- Legacy Color Management option disabled is emulated by using None display.
  It could have some regressions, but there's no clear way to avoid them.
- If OpenColorIO is disabled on build time, it should make blender behaving
  in the same way as previous release with color management enabled.
More details could be found at this page (more details would be added soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Color_Management
--
Thanks to Xavier Thomas, Lukas Toene for initial work on OpenColorIO
integration and to Brecht van Lommel for some further development and code/
usecase review!
											 
										 
										
											2012-09-15 10:05:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ntreeCompositExecTree ( scene - > nodetree ,  & scene - > r ,  0 ,  scene - > r . cfra  ! =  rcd - > old_cfra , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									                      & scene - > view_settings ,  & scene - > display_settings ) ;   /* 1 is no previews */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ibuf  =  BKE_image_acquire_ibuf ( sima - > image ,  & sima - > iuser ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* save memory in flipbooks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ibuf ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										imb_freerectfloatImBuf ( ibuf ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-15 15:59:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BKE_image_release_ibuf ( sima - > image ,  ibuf ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scene - > r . cfra + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ( scene - > r . cfra  < =  rcd - > efra ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_record_composite_init ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RecordCompositeData  * rcd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > iuser . frames  <  2 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( scene - > nodetree  = =  NULL ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									op - > customdata  =  rcd  =  MEM_callocN ( sizeof ( RecordCompositeData ) ,  " ImageRecordCompositeData " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rcd - > old_cfra  =  scene - > r . cfra ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rcd - > sfra  =  sima - > iuser . sfra ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rcd - > efra  =  sima - > iuser . sfra  +  sima - > iuser . frames  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									scene - > r . cfra  =  rcd - > sfra ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_record_composite_exit ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RecordCompositeData  * rcd  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									scene - > r . cfra  =  rcd - > old_cfra ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-06 22:34:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_cursor_modal_restore ( CTX_wm_window ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( rcd - > timer ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-20 13:58:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										WM_event_remove_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  rcd - > timer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  sima - > image ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-11 19:16:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// XXX play_anim(0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// XXX allqueue(REDRAWNODE, 1);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									MEM_freeN ( rcd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_record_composite_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! image_record_composite_init ( C ,  op ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-21 07:58:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									while  ( image_record_composite_apply ( C ,  op ) )  { } 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_record_composite_exit ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_record_composite_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * UNUSED ( event ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-12 03:41:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RecordCompositeData  * rcd ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! image_record_composite_init ( C ,  op ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rcd  =  op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rcd - > timer  =  WM_event_add_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  TIMER ,  0.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-18 12:43:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_modal_handler ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! image_record_composite_apply ( C ,  op ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-03-13 09:03:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_record_composite_modal ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RecordCompositeData  * rcd  =  op - > customdata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									switch  ( event - > type )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  TIMER : 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-24 06:38:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( rcd - > timer  = =  event - > customdata )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! image_record_composite_apply ( C ,  op ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													image_record_composite_exit ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  ESCKEY : 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											image_record_composite_exit ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-30 23:08:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  image_record_composite_cancel ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									image_record_composite_exit ( C ,  op ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_record_composite ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Record Composite " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_record_composite " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-10 23:17:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_record_composite_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  image_record_composite_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  image_record_composite_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  image_record_composite_cancel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_buffer_exists_poll ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5: Space Image ported back
Organized as follows:
uvedit/
	uv editing related code
	uvedit_draw.c: drawing code
	uvedit_ops.c: operators, just a few done
	uvedit_unwrap_ops.c: will be operators for unwrapping
	uvedit_paramatrizer.c: lscm/abf/stretch/pack
space_image/
	space_image.c: registration and common getter/setters
	image_draw.c: drawing code, mostly functional
	image_panels.c: panels, all commented out
	image_render.c: render callbacks, non functional
	image_ops.c: operators, only view navigation done
	image_header.c: header, menus mostly done but missing buttons
Notes:
* Header menus consist only of Operator and RNA buttons, if they
  are not implemented they're displayed grayed out. Ideally the full
  header could work like this, but std_libbuttons looks problematic.
* Started using view2d code more than the old code, but for now it
  still does own view2d management due to some very specific
  requirements that the image window has. The drawing code however
  is more clear hopefully, it only uses view2d, and there is no
  switching between 'p' and 'f' view2d's anymore, it is always 'f'.
* In order to make uvedit operators more independent I move some
  image space settings to scene toolsettings, and the current image
  and its buffer is in the context. Especially sync selection and
  select mode belonged there anyway as this cannot work correct with
  different spaces having different settings anyway.
* Image paint is not back yet, did not want to put that together with
  uvedit because there's really no code sharing.. perhaps vertex paint,
  image paint and sculpt would be good to have in one module to share
  brush code, partial redraw, etc better.
											 
										 
										
											2009-01-15 04:38:18 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-28 22:50:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/********************* cycle render slot operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  image_cycle_render_slot_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ( ima  & &  ima - > type  = =  IMA_TYPE_R_RESULT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-28 03:02:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  image_cycle_render_slot_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Image  * ima  =  CTX_data_edit_image ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-16 07:13:40 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									const  int  direction  =  RNA_boolean_get ( op - > ptr ,  " reverse " )  ?  - 1  :  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-16 07:13:40 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ED_image_slot_cycle ( ima ,  direction ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  ND_DRAW ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-10 17:34:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* no undo push for browsing existing */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-28 11:53:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ima - > renders [ ima - > render_slot ]  | |  ima - > render_slot  = =  ima - > last_render_slot ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-10 17:34:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_cycle_render_slot ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Cycle Render Slot " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_cycle_render_slot " ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-04 15:00:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Cycle through all non-void render slots " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-04 09:31:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-22 07:26:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_cycle_render_slot_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_cycle_render_slot_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-10 17:34:27 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-23 20:58:09 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-13 05:02:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_boolean ( ot - > srna ,  " reverse " ,  0 ,  " Cycle in Reverse " ,  " " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-09 19:37:37 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/********************** change frame operator *********************/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-02 11:47:00 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  bool  change_frame_poll ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* prevent changes during render */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( G . is_rendering ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  space_image_main_region_poll ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  change_frame_apply ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* set the new frame number */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CFRA  =  RNA_int_get ( op - > ptr ,  " frame " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FRAMENUMBER_MIN_CLAMP ( CFRA ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SUBFRA  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* do updates */ 
							 
						 
					
						
							
								
									
										
										
										
											2015-03-26 11:35:41 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									BKE_sound_seek_scene ( CTX_data_main ( C ) ,  scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE  |  ND_FRAME ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  change_frame_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									change_frame_apply ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  frame_from_event ( bContext  * C ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  framenr  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  sfra  =  SFRA ,  efra  =  EFRA ,  framelen  =  ar - > winx  /  ( efra  -  sfra  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										framenr  =  sfra  +  event - > mval [ 0 ]  /  framelen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  viewx ,  viewy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										UI_view2d_region_to_view ( & ar - > v2d ,  event - > mval [ 0 ] ,  event - > mval [ 1 ] ,  & viewx ,  & viewy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-09-27 11:13:03 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										framenr  =  round_fl_to_int ( viewx ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  framenr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  change_frame_invoke ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-09 20:33:19 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( event - > mval [ 1 ]  >  16  | |  ! ED_space_image_show_cache ( sima ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return  OPERATOR_PASS_THROUGH ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-09 20:33:19 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-02 17:58:34 +06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_int_set ( op - > ptr ,  " frame " ,  frame_from_event ( C ,  event ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									change_frame_apply ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* add temp handler */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_event_add_modal_handler ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  change_frame_modal ( bContext  * C ,  wmOperator  * op ,  const  wmEvent  * event ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( event - > type )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  ESCKEY : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MOUSEMOVE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											RNA_int_set ( op - > ptr ,  " frame " ,  frame_from_event ( C ,  event ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											change_frame_apply ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  LEFTMOUSE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  RIGHTMOUSE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( event - > val  = =  KM_RELEASE ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_change_frame ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name  =  " Change Frame " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_change_frame " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > description  =  " Interactively change the current frame number " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec  =  change_frame_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke  =  change_frame_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal  =  change_frame_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  change_frame_poll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_BLOCKING  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* rna */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RNA_def_int ( ot - > srna ,  " frame " ,  0 ,  MINAFRAME ,  MAXFRAME ,  " Frame " ,  " " ,  MINAFRAME ,  MAXFRAME ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-28 19:13:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Reload cached render results... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* goes over all scenes, reads render layers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  image_read_renderlayers_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Main  * bmain  =  CTX_data_main ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-28 19:13:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceImage  * sima  =  CTX_wm_space_image ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Image  * ima ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-11 15:40:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ima  =  BKE_image_verify_viewer ( bmain ,  IMA_TYPE_R_RESULT ,  " Render Result " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-28 19:13:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( sima - > image  = =  NULL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-31 18:23:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_space_image_set ( bmain ,  sima ,  scene ,  NULL ,  ima ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-28 19:13:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RE_ReadRenderResult ( scene ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_IMAGE  |  NA_EDITED ,  ima ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_read_renderlayers ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name  =  " Read Render Layers " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_read_renderlayers " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > description  =  " Read all the current scene's render layers from cache, as needed " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-28 17:14:45 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  space_image_main_region_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-28 19:13:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  image_read_renderlayers_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-08 18:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* ********************* Render border operator ****************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  render_border_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-12 11:27:22 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Render  * re  =  RE_GetSceneRender ( scene ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-18 13:24:21 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RenderData  * rd ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-08 18:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rctf  border ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-12-18 13:24:21 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( re  = =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Shouldn't happen, but better be safe close to the release. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rd  =  RE_engine_get_render_data ( re ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-18 13:12:25 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ( rd - > mode  &  ( R_BORDER  |  R_CROP ) )  = =  ( R_BORDER  |  R_CROP ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-12-18 13:24:21 +05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_INFO ,  " Can not set border from a cropped render " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-10-08 18:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* get rectangle from operator */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_operator_properties_border_to_rctf ( op ,  & border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									UI_view2d_region_to_view_rctf ( & ar - > v2d ,  & border ,  & border ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* actually set border */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CLAMP ( border . xmin ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CLAMP ( border . ymin ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CLAMP ( border . xmax ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CLAMP ( border . ymax ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									scene - > r . border  =  border ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* drawing a border surrounding the entire camera view switches off border rendering
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  or  the  border  covers  no  pixels  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ( border . xmin  < =  0.0f  & &  border . xmax  > =  1.0f  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     border . ymin  < =  0.0f  & &  border . ymax  > =  1.0f )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									    ( border . xmin  = =  border . xmax  | |  border . ymin  = =  border . ymax ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scene - > r . mode  & =  ~ R_BORDER ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										scene - > r . mode  | =  R_BORDER ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE  |  ND_RENDER_OPTIONS ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_render_border ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name  =  " Render Border " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > description  =  " Set the boundaries of the border render and enable border render " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_render_border " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 17:01:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > invoke  =  WM_gesture_border_invoke ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-08 18:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > exec  =  render_border_exec ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-16 17:01:28 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > modal  =  WM_gesture_border_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel  =  WM_gesture_border_cancel ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-08 18:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_cycle_render_slot_poll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* rna */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_operator_properties_border ( ot ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* ********************* Clear render border operator ****************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  clear_render_border_exec ( bContext  * C ,  wmOperator  * UNUSED ( op ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									scene - > r . mode  & =  ~ R_BORDER ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE  |  ND_RENDER_OPTIONS ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BLI_rctf_init ( & scene - > r . border ,  0.0f ,  1.0f ,  0.0f ,  1.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  IMAGE_OT_clear_render_border ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-20 15:02:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > name  =  " Clear Render Border " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-08 18:02:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description  =  " Clear the boundaries of the border render and disable border render " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname  =  " IMAGE_OT_clear_render_border " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec  =  clear_render_border_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll  =  image_cycle_render_slot_poll ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag  =  OPTYPE_REGISTER  |  OPTYPE_UNDO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}