2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/**
 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-21 01:14:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *  $ Id $ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +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 . 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  The  Original  Code  is  Copyright  ( C )  2008  Blender  Foundation . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  All  rights  reserved . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Contributor ( s ) :  Blender  Foundation 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  * * * * *  END  GPL  LICENSE  BLOCK  * * * * * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <string.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <stdio.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <math.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <float.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-05 08:14:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "DNA_anim_types.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "DNA_camera_types.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "DNA_lamp_types.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "DNA_scene_types.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "MEM_guardedalloc.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BLI_math.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 16:03:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BLI_blenlib.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BLI_editVert.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BLI_rand.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_anim.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_action.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-21 11:05:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_context.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_object.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_global.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_main.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_report.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_scene.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_screen.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BKE_utildefines.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BKE_depsgraph.h" /* for fly mode updating */ 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "BIF_gl.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-19 21:24:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "BIF_glutil.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "WM_api.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "WM_types.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-05 08:14:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_keyframing.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "ED_screen.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-20 18:00:51 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "ED_armature.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-27 11:54:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "GPU_draw.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-22 18:19:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "PIL_time.h" /* smoothview */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-02 01:39:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if GAMEBLENDER == 1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "SYS_System.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "view3d_intern.h"	// own include 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-21 11:05:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* use this call when executing an operator,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   event  system  doesn ' t  set  for  each  event  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   opengl  drawing  context  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  view3d_operator_needs_opengl ( const  bContext  * C ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* for debugging purpose, context should always be OK */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ar - > regiontype ! = RGN_TYPE_WINDOW ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										printf ( " view3d_operator_needs_opengl error, wrong region \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-21 11:05:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										wmSubWindowSet ( CTX_wm_window ( C ) ,  ar - > swinid ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										glMatrixMode ( GL_PROJECTION ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-01 15:32:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										glLoadMatrixf ( rv3d - > winmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-21 11:05:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										glMatrixMode ( GL_MODELVIEW ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-01 15:32:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										glLoadMatrixf ( rv3d - > viewmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-21 11:05:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								float  * give_cursor ( Scene  * scene ,  View3D  * v3d ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 04:40:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( v3d  & &  v3d - > localvd )  return  v3d - > cursor ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									else  return  scene - > cursor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Gets the lens and clipping values from a camera of lamp type object */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  object_lens_clip_settings ( Object  * ob ,  float  * lens ,  float  * clipsta ,  float  * clipend ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! ob )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ob - > type = = OB_LAMP  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Lamp  * la  =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( lens )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  x1 ,  fac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fac =  cos (  M_PI * la - > spotsize / 360.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											x1 =  saacos ( fac ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											* lens =  16.0 * fac / sin ( x1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( clipsta ) 	* clipsta =  la - > clipsta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( clipend ) 	* clipend =  la - > clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if ( ob - > type = = OB_CAMERA )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Camera  * cam =  ob - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( lens ) 		* lens =  cam - > lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( clipsta ) 	* clipsta =  cam - > clipsta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( clipend ) 	* clipend =  cam - > clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( lens ) 		* lens =  35.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Gets the view trasnformation from a camera
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  currently  dosnt  take  camzoom  into  account 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  The  dist  is  not  modified  for  this  function ,  if  NULL  its  assimed  zero 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  view_settings_from_ob ( Object  * ob ,  float  * ofs ,  float  * quat ,  float  * dist ,  float  * lens ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  bmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  imat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  tmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! ob )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Offset */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 09:02:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ofs ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										negate_v3_v3 ( ofs ,  ob - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* Quat */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( quat )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										copy_m4_m4 ( bmat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										normalize_m4 ( bmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										invert_m4_m4 ( imat ,  bmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										copy_m3_m4 ( tmat ,  imat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mat3_to_quat (  quat , tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( dist )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  vec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										copy_m3_m4 ( tmat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 0 ] =  vec [ 1 ]  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 2 ] =  - ( * dist ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_m3_v3 ( tmat ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sub_v3_v3v3 ( ofs ,  ofs ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Lens */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( lens ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										object_lens_clip_settings ( ob ,  lens ,  NULL ,  NULL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* ****************** smooth view operator ****************** */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 23:11:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* This operator is one of the 'timer refresh' ones like animation playback */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								struct  SmoothViewStore  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  orig_dist ,  new_dist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  orig_lens ,  new_lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  orig_quat [ 4 ] ,  new_quat [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  orig_ofs [ 3 ] ,  new_ofs [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  to_camera ,  orig_view ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									double  time_allowed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* will start timer if appropriate */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* the arguments are the desired situation */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  smooth_view ( bContext  * C ,  Object  * oldcamera ,  Object  * camera ,  float  * ofs ,  float  * quat ,  float  * dist ,  float  * lens ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  SmoothViewStore  sms ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* initialize sms */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-05 13:20:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									memset ( & sms , 0 , sizeof ( struct  SmoothViewStore ) ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									VECCOPY ( sms . new_ofs ,  rv3d - > ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QUATCOPY ( sms . new_quat ,  rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sms . new_dist =  rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sms . new_lens =  v3d - > lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sms . to_camera =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* store the options we want to end with */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ofs )  VECCOPY ( sms . new_ofs ,  ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( quat )  QUATCOPY ( sms . new_quat ,  quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( dist )  sms . new_dist =  * dist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( lens )  sms . new_lens =  * lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( camera )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										view_settings_from_ob ( camera ,  sms . new_ofs ,  sms . new_quat ,  & sms . new_dist ,  & sms . new_lens ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										sms . to_camera =  1 ;  /* restore view3d values in end */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( C  & &  U . smooth_viewtx )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  changed  =  0 ;  /* zero means no difference */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( sms . new_dist  ! =  rv3d - > dist ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											changed  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( sms . new_lens  ! =  v3d - > lens ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											changed  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( sms . new_ofs [ 0 ] ! = rv3d - > ofs [ 0 ] )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( sms . new_ofs [ 1 ] ! = rv3d - > ofs [ 1 ] )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( sms . new_ofs [ 2 ] ! = rv3d - > ofs [ 2 ] )  ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											changed  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( sms . new_quat [ 0 ] ! = rv3d - > viewquat [ 0 ] )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( sms . new_quat [ 1 ] ! = rv3d - > viewquat [ 1 ] )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( sms . new_quat [ 2 ] ! = rv3d - > viewquat [ 2 ] )  | | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( sms . new_quat [ 3 ] ! = rv3d - > viewquat [ 3 ] )  ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											changed  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* The new view is different from the old one
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											*  so  animate  the  view  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( changed )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sms . time_allowed =  ( double ) U . smooth_viewtx  /  1000.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* if this is view rotation only
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												*  we  can  decrease  the  time  allowed  by 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												*  the  angle  between  quats  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												*  this  means  small  rotations  wont  lag  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( quat  & &  ! ofs  & &  ! dist )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												 float  vec1 [ 3 ] ,  vec2 [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												 VECCOPY ( vec1 ,  sms . new_quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 VECCOPY ( vec2 ,  sms . orig_quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 normalize_v3 ( vec1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 normalize_v3 ( vec2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 /* scale the time allowed by the rotation */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 sms . time_allowed  * =  angle_normalized_v3v3 ( vec1 ,  vec2 ) / ( M_PI / 2 ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* original values */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( oldcamera )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												sms . orig_dist =  rv3d - > dist ;  // below function does weird stuff with it...
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												view_settings_from_ob ( oldcamera ,  sms . orig_ofs ,  sms . orig_quat ,  & sms . orig_dist ,  & sms . orig_lens ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												VECCOPY ( sms . orig_ofs ,  rv3d - > ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												QUATCOPY ( sms . orig_quat ,  rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												sms . orig_dist =  rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												sms . orig_lens =  v3d - > lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* grid draw as floor */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-30 18:54:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if ( ( rv3d - > viewlock  &  RV3D_LOCKED ) = = 0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* use existing if exists, means multiple calls to smooth view wont loose the original 'view' setting */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												sms . orig_view =  rv3d - > sms  ?  rv3d - > sms - > orig_view  :  rv3d - > view ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > view =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* ensure it shows correct */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if ( sms . to_camera )  rv3d - > persp =  RV3D_PERSP ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-25 14:13:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rv3d - > rflag  | =  RV3D_NAVIGATING ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* keep track of running timer! */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if ( rv3d - > sms = = NULL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > sms =  MEM_mallocN ( sizeof ( struct  SmoothViewStore ) ,  " smoothview v3d " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											* rv3d - > sms =  sms ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( rv3d - > smooth_timer ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-20 13:58:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												WM_event_remove_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  rv3d - > smooth_timer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* TIMER1 is hardcoded in keymap */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 21:31:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > smooth_timer =  WM_event_add_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  TIMER1 ,  1.0 / 100.0 ) ; 	/* max 30 frs/sec */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* if we get here nothing happens */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( sms . to_camera = = 0 )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										VECCOPY ( rv3d - > ofs ,  sms . new_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QUATCOPY ( rv3d - > viewquat ,  sms . new_quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rv3d - > dist  =  sms . new_dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										v3d - > lens  =  sms . new_lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* only meant for timer usage */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  view3d_smoothview_invoke ( bContext  * C ,  wmOperator  * op ,  wmEvent  * event ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  SmoothViewStore  * sms =  rv3d - > sms ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									double  step ,  step_inv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* escape if not our timer */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > smooth_timer = = NULL  | |  rv3d - > smooth_timer ! = event - > customdata ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  OPERATOR_PASS_THROUGH ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									step  =   ( rv3d - > smooth_timer - > duration ) / sms - > time_allowed ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* end timer */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( step  > =  1.0f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* if we went to camera, store the original */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( sms - > to_camera )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > persp =  RV3D_CAMOB ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											VECCOPY ( rv3d - > ofs ,  sms - > orig_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QUATCOPY ( rv3d - > viewquat ,  sms - > orig_quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rv3d - > dist  =  sms - > orig_dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											v3d - > lens  =  sms - > orig_lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											VECCOPY ( rv3d - > ofs ,  sms - > new_ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QUATCOPY ( rv3d - > viewquat ,  sms - > new_quat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rv3d - > dist  =  sms - > new_dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											v3d - > lens  =  sms - > new_lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2010-01-30 18:54:36 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( ( rv3d - > viewlock  &  RV3D_LOCKED ) = = 0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rv3d - > view =  sms - > orig_view ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										MEM_freeN ( rv3d - > sms ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rv3d - > sms =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-10-20 13:58:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										WM_event_remove_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  rv3d - > smooth_timer ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rv3d - > smooth_timer =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-25 14:13:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rv3d - > rflag  & =  ~ RV3D_NAVIGATING ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* ease in/out */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( step  <  0.5 ) 	step  =  ( float ) pow ( step * 2 ,  2 ) / 2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 			step  =  ( float ) 1 - ( pow ( 2 * ( 1 - step ) , 2 ) / 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										step_inv  =  1.0 - step ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( i = 0 ;  i < 3 ;  i + + ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > ofs [ i ]  =  sms - > new_ofs [ i ] * step  +  sms - > orig_ofs [ i ] * step_inv ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										interp_qt_qtqt ( rv3d - > viewquat ,  sms - > orig_quat ,  sms - > new_quat ,  step ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rv3d - > dist  =  sms - > new_dist * step  +  sms - > orig_dist * step_inv ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										v3d - > lens  =  sms - > new_lens * step  +  sms - > orig_lens * step_inv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  VIEW3D_OT_smoothview ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name =  " Smooth View " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > idname =  " VIEW3D_OT_smoothview " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-12 17:16:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description = " The time to animate the change of view (in milliseconds) " ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke =  view3d_smoothview_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 19:07:31 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll =  ED_operator_view3d_active ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 23:11:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* ****************** change view operators ****************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  setcameratoview3d ( View3D  * v3d ,  RegionView3D  * rv3d ,  Object  * ob ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  dvec [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-19 10:27:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  mat3 [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:26:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mul_v3_v3fl ( dvec ,  rv3d - > viewinv [ 2 ] ,  rv3d - > dist ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sub_v3_v3v3 ( ob - > loc ,  dvec ,  rv3d - > ofs ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d - > viewquat [ 0 ] =  - rv3d - > viewquat [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-19 10:27:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// quat_to_eul( ob->rot,rv3d->viewquat); // in 2.4x for xyz eulers only
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									quat_to_mat3 ( mat3 ,  rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									object_mat3_to_rot ( ob ,  mat3 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d - > viewquat [ 0 ] =  - rv3d - > viewquat [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ob - > recalc =  OB_RECALC_OB ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  view3d_setcameratoview_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									setcameratoview3d ( v3d ,  rv3d ,  v3d - > camera ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d - > persp  =  RV3D_CAMOB ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-01-25 19:42:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_OBJECT | ND_TRANSFORM ,  v3d - > camera ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-10 23:50:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  view3d_setcameratoview_poll ( bContext  * C ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( v3d = = NULL  | |  v3d - > camera = = NULL ) 	return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( rv3d  & &  rv3d - > viewlock  ! =  0 ) 		return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  VIEW3D_OT_setcameratoview ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name =  " Align Camera To View " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description =  " Set camera view to active view " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-29 02:15:13 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname =  " VIEW3D_OT_camera_to_view " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec =  view3d_setcameratoview_exec ; 	
							 
						 
					
						
							
								
									
										
										
										
											2009-10-10 23:50:15 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll =  view3d_setcameratoview_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-31 19:40:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag =  OPTYPE_REGISTER | OPTYPE_UNDO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-06 00:19:47 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 23:11:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 02:45:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  view3d_setobjectascamera_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( BASACT )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rv3d - > persp =  RV3D_CAMOB ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 02:45:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										v3d - > camera =  OBACT ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 23:13:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( v3d - > scenelock ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											scene - > camera =  OBACT ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 02:45:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										smooth_view ( C ,  NULL ,  v3d - > camera ,  rv3d - > ofs ,  rv3d - > viewquat ,  & rv3d - > dist ,  & v3d - > lens ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 23:13:07 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_add_notifier ( C ,  NC_SCENE | ND_RENDER_OPTIONS | NC_OBJECT | ND_DRAW ,  CTX_data_scene ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 02:45:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  VIEW3D_OT_setobjectascamera ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name =  " Set Active Object as Camera " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description =  " Set the active object as the active camera for this view or scene " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-06 02:45:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname =  " VIEW3D_OT_object_as_camera " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec =  view3d_setobjectascamera_exec ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll =  ED_operator_view3d_active ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag =  OPTYPE_REGISTER | OPTYPE_UNDO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-22 23:11:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* ********************************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 19:53:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  view3d_calculate_clipping ( BoundBox  * bb ,  float  planes [ 4 ] [ 4 ] ,  bglMats  * mats ,  rcti  * rect ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									double  xs ,  ys ,  p [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* near zero floating point values can give issues with gluUnProject
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										in  side  view  on  some  implementations  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( fabs ( mats - > modelview [ 0 ] )  <  1e-6 )  mats - > modelview [ 0 ] =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( fabs ( mats - > modelview [ 5 ] )  <  1e-6 )  mats - > modelview [ 5 ] =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Set up viewport so that gluUnProject will give correct values */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mats - > viewport [ 0 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mats - > viewport [ 1 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* four clipping planes and bounding volume */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* first do the bounding volume */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( val = 0 ;  val < 4 ;  val + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										xs =  ( val = = 0 | | val = = 3 ) ? rect - > xmin : rect - > xmax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ys =  ( val = = 0 | | val = = 1 ) ? rect - > ymin : rect - > ymax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										gluUnProject ( xs ,  ys ,  0.0 ,  mats - > modelview ,  mats - > projection ,  mats - > viewport ,  & p [ 0 ] ,  & p [ 1 ] ,  & p [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( bb - > vec [ val ] ,  p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										gluUnProject ( xs ,  ys ,  1.0 ,  mats - > modelview ,  mats - > projection ,  mats - > viewport ,  & p [ 0 ] ,  & p [ 1 ] ,  & p [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( bb - > vec [ 4 + val ] ,  p ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* then plane equations */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( val = 0 ;  val < 4 ;  val + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 10:44:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										normal_tri_v3 ( planes [ val ] ,  bb - > vec [ val ] ,  bb - > vec [ val = = 3 ? 0 : val + 1 ] ,  bb - > vec [ val + 4 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 19:53:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										planes [ val ] [ 3 ] =  -  planes [ val ] [ 0 ] * bb - > vec [ val ] [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											-  planes [ val ] [ 1 ] * bb - > vec [ val ] [ 1 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											-  planes [ val ] [ 2 ] * bb - > vec [ val ] [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* create intersection coordinates in view Z direction at mouse coordinates */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-12 22:33:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  viewline ( ARegion  * ar ,  View3D  * v3d ,  float  mval [ 2 ] ,  float  ray_start [ 3 ] ,  float  ray_end [ 3 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  vec [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-05 14:26:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  a ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2010-03-12 17:12:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( ! get_view3d_ortho ( v3d ,  rv3d ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										vec [ 0 ] =  2.0f  *  mval [ 0 ]  /  ar - > winx  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 1 ] =  2.0f  *  mval [ 1 ]  /  ar - > winy  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 2 ] =  - 1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 3 ] =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_m4_v4 ( rv3d - > persinv ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mul_v3_fl ( vec ,  1.0f  /  vec [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-11-11 10:44:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										copy_v3_v3 ( ray_start ,  rv3d - > viewinv [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sub_v3_v3v3 ( vec ,  vec ,  ray_start ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										normalize_v3 ( vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										VECADDFAC ( ray_start ,  rv3d - > viewinv [ 3 ] ,  vec ,  v3d - > near ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECADDFAC ( ray_end ,  rv3d - > viewinv [ 3 ] ,  vec ,  v3d - > far ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 0 ]  =  2.0f  *  mval [ 0 ]  /  ar - > winx  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 1 ]  =  2.0f  *  mval [ 1 ]  /  ar - > winy  -  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 2 ]  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 3 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_m4_v4 ( rv3d - > persinv ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										VECADDFAC ( ray_start ,  vec ,  rv3d - > viewinv [ 2 ] ,   1000.0f ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECADDFAC ( ray_end ,  vec ,  rv3d - > viewinv [ 2 ] ,  - 1000.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-05 14:26:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* clipping */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( rv3d - > rflag  &  RV3D_CLIPPING ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for ( a = 0 ;  a < 4 ;  a + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											clip_line_plane ( ray_start ,  ray_end ,  rv3d - > clip [ a ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* create intersection ray in view Z direction at mouse coordinates */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-12 22:33:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  viewray ( ARegion  * ar ,  View3D  * v3d ,  float  mval [ 2 ] ,  float  ray_start [ 3 ] ,  float  ray_normal [ 3 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  ray_end [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									viewline ( ar ,  v3d ,  mval ,  ray_start ,  ray_end ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									sub_v3_v3v3 ( ray_normal ,  ray_end ,  ray_start ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									normalize_v3 ( ray_normal ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 22:40:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  viewvector ( RegionView3D  * rv3d ,  float  coord [ 3 ] ,  float  vec [ 3 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( rv3d - > persp  ! =  RV3D_ORTHO ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  p1 [ 4 ] ,  p2 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( p1 ,  coord ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										p1 [ 3 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( p2 ,  p1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										p2 [ 3 ]  =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mul_m4_v4 ( rv3d - > viewmat ,  p2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:26:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_v3_fl ( p2 ,  2.0f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-28 22:40:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mul_m4_v4 ( rv3d - > viewinv ,  p2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sub_v3_v3v3 ( vec ,  p1 ,  p2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( vec ,  rv3d - > viewinv [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									normalize_v3 ( vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  initgrabz ( RegionView3D  * rv3d ,  float  x ,  float  y ,  float  z ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d = = NULL )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rv3d - > zfac =  rv3d - > persmat [ 0 ] [ 3 ] * x +  rv3d - > persmat [ 1 ] [ 3 ] * y +  rv3d - > persmat [ 2 ] [ 3 ] * z +  rv3d - > persmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* if x,y,z is exactly the viewport offset, zfac is 0 and we don't want that 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										*  ( accounting  for  near  zero  values ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										*  */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( rv3d - > zfac  <  1.e-6 f  & &  rv3d - > zfac  >  - 1.e-6 f )  rv3d - > zfac  =  1.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Negative zfac means x, y, z was behind the camera (in perspective).
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										*  This  gives  flipped  directions ,  so  revert  back  to  ok  default  case . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									*/ 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-31 04:24:28 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// NOTE: I've changed this to flip zfac to be positive again for now so that GPencil draws ok
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// 	-- Aligorith, 2009Aug31
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//if (rv3d->zfac < 0.0f) rv3d->zfac = 1.0f;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( rv3d - > zfac  <  0.0f )  rv3d - > zfac =  - rv3d - > zfac ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 18:31:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* always call initgrabz */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  window_to_3d ( ARegion  * ar ,  float  * vec ,  short  mx ,  short  my ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 18:31:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  dx =  ( ( float ) ( mx - ( ar - > winx / 2 ) ) ) * rv3d - > zfac / ( ar - > winx / 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  dy =  ( ( float ) ( my - ( ar - > winy / 2 ) ) ) * rv3d - > zfac / ( ar - > winy / 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  fz =  rv3d - > persmat [ 0 ] [ 3 ] * vec [ 0 ] +  rv3d - > persmat [ 1 ] [ 3 ] * vec [ 1 ] +  rv3d - > persmat [ 2 ] [ 3 ] * vec [ 2 ] +  rv3d - > persmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fz =  fz / rv3d - > zfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec [ 0 ] =  ( rv3d - > persinv [ 0 ] [ 0 ] * dx  +  rv3d - > persinv [ 1 ] [ 0 ] * dy +  rv3d - > persinv [ 2 ] [ 0 ] * fz ) - rv3d - > ofs [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec [ 1 ] =  ( rv3d - > persinv [ 0 ] [ 1 ] * dx  +  rv3d - > persinv [ 1 ] [ 1 ] * dy +  rv3d - > persinv [ 2 ] [ 1 ] * fz ) - rv3d - > ofs [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec [ 2 ] =  ( rv3d - > persinv [ 0 ] [ 2 ] * dx  +  rv3d - > persinv [ 1 ] [ 2 ] * dy +  rv3d - > persinv [ 2 ] [ 2 ] * fz ) - rv3d - > ofs [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* always call initgrabz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* only to detect delta motion */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  window_to_3d_delta ( ARegion  * ar ,  float  * vec ,  short  mx ,  short  my ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  dx ,  dy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									dx =  2.0f * mx * rv3d - > zfac / ar - > winx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									dy =  2.0f * my * rv3d - > zfac / ar - > winy ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vec [ 0 ] =  ( rv3d - > persinv [ 0 ] [ 0 ] * dx  +  rv3d - > persinv [ 1 ] [ 0 ] * dy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec [ 1 ] =  ( rv3d - > persinv [ 0 ] [ 1 ] * dx  +  rv3d - > persinv [ 1 ] [ 1 ] * dy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec [ 2 ] =  ( rv3d - > persinv [ 0 ] [ 2 ] * dx  +  rv3d - > persinv [ 1 ] [ 2 ] * dy ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-16 01:56:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								float  read_cached_depth ( ViewContext  * vc ,  int  x ,  int  y ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ViewDepths  * vd  =  vc - > rv3d - > depths ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-16 01:56:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-02-22 22:00:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									x  - =  vc - > ar - > winrct . xmin ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-16 01:56:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									y  - =  vc - > ar - > winrct . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( vd  & &  vd - > depths  & &  x  >  0  & &  y  >  0  & &  x  <  vd - > w  & &  y  <  vd - > h ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  vd - > depths [ y  *  vd - > w  +  x ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-30 18:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  request_depth_update ( RegionView3D  * rv3d ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-17 03:31:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-30 18:27:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > depths ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rv3d - > depths - > damaged =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-17 03:31:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-18 16:42:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  view3d_get_object_project_mat ( RegionView3D  * rv3d ,  Object  * ob ,  float  pmat [ 4 ] [ 4 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-05-18 16:42:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  vmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_m4m4 ( vmat ,  ob - > obmat ,  rv3d - > viewmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mul_m4_m4m4 ( pmat ,  vmat ,  rv3d - > winmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-19 21:24:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* Uses window coordinates (x,y) and depth component z to find a point in
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   modelspace  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  view3d_unproject ( bglMats  * mats ,  float  out [ 3 ] ,  const  short  x ,  const  short  y ,  const  float  z ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									double  ux ,  uy ,  uz ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										gluUnProject ( x , y , z ,  mats - > modelview ,  mats - > projection , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											 ( GLint  * ) mats - > viewport ,  & ux ,  & uy ,  & uz  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-19 21:24:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									out [ 0 ]  =  ux ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									out [ 1 ]  =  uy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									out [ 2 ]  =  uz ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-05-18 16:42:34 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* use above call to get projecting mat */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								void  view3d_project_float ( ARegion  * ar ,  float  * vec ,  float  * adr ,  float  mat [ 4 ] [ 4 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									adr [ 0 ] =  IS_CLIPPED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( mat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  vec4 [ 3 ] > FLT_EPSILON  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  ( float ) ( ar - > winx / 2.0f ) + ( ar - > winx / 2.0f ) * vec4 [ 0 ] / vec4 [ 3 ] ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 1 ]  =  ( float ) ( ar - > winy / 2.0f ) + ( ar - > winy / 2.0f ) * vec4 [ 1 ] / vec4 [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  adr [ 1 ]  =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  boundbox_clip ( RegionView3D  * rv3d ,  float  obmat [ ] [ 4 ] ,  BoundBox  * bb ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* return 1: draw */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  vec [ 4 ] ,  min ,  max ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  a ,  flag =  - 1 ,  fl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( bb = = NULL )  return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( bb - > flag  &  OB_BB_DISABLED )  return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_m4m4 ( mat ,  obmat ,  rv3d - > persmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( a = 0 ;  a < 8 ;  a + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( vec ,  bb - > vec [ a ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vec [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_m4_v4 ( mat ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										max =  vec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										min =  - vec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fl =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( vec [ 0 ]  <  min )  fl + =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( vec [ 0 ]  >  max )  fl + =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( vec [ 1 ]  <  min )  fl + =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( vec [ 1 ]  >  max )  fl + =  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( vec [ 2 ]  <  min )  fl + =  16 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( vec [ 2 ]  >  max )  fl + =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										flag  & =  fl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( flag = = 0 )  return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  project_short ( ARegion  * ar ,  float  * vec ,  short  * adr ) 	/* clips */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  fx ,  fy ,  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									adr [ 0 ] =  IS_CLIPPED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > rflag  &  RV3D_CLIPPING )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-21 16:44:05 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( view3d_test_clipping ( rv3d ,  vec ,  0 ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( rv3d - > persmat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  vec4 [ 3 ] > BL_NEAR_CLIP  )  { 	/* 0.001 is the NEAR clipping cutoff for picking */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fx =  ( ar - > winx / 2 ) * ( 1  +  vec4 [ 0 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if (  fx > 0  & &  fx < ar - > winx )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fy =  ( ar - > winy / 2 ) * ( 1  +  vec4 [ 1 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( fy > 0.0  & &  fy <  ( float ) ar - > winy )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												adr [ 0 ] =  ( short ) floor ( fx ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												adr [ 1 ] =  ( short ) floor ( fy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  project_int ( ARegion  * ar ,  float  * vec ,  int  * adr ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  fx ,  fy ,  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									adr [ 0 ] =  ( int ) 2140000000.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( rv3d - > persmat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  vec4 [ 3 ] > BL_NEAR_CLIP  )  { 	/* 0.001 is the NEAR clipping cutoff for picking */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fx =  ( ar - > winx / 2 ) * ( 1  +  vec4 [ 0 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if (  fx > - 2140000000.0f  & &  fx < 2140000000.0f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fy =  ( ar - > winy / 2 ) * ( 1  +  vec4 [ 1 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( fy > - 2140000000.0f  & &  fy < 2140000000.0f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												adr [ 0 ] =  ( int ) floor ( fx ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												adr [ 1 ] =  ( int ) floor ( fy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  project_int_noclip ( ARegion  * ar ,  float  * vec ,  int  * adr ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  fx ,  fy ,  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( rv3d - > persmat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  fabs ( vec4 [ 3 ] )  >  BL_NEAR_CLIP  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fx  =  ( ar - > winx / 2 ) * ( 1  +  vec4 [ 0 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fy  =  ( ar - > winy / 2 ) * ( 1  +  vec4 [ 1 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  ( int ) floor ( fx ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 1 ]  =  ( int ) floor ( fy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  ar - > winx  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 1 ]  =  ar - > winy  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  project_short_noclip ( ARegion  * ar ,  float  * vec ,  short  * adr ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  fx ,  fy ,  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									adr [ 0 ] =  IS_CLIPPED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( rv3d - > persmat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  vec4 [ 3 ] > BL_NEAR_CLIP  )  { 	/* 0.001 is the NEAR clipping cutoff for picking */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fx =  ( ar - > winx / 2 ) * ( 1  +  vec4 [ 0 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if (  fx > - 32700  & &  fx < 32700 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fy =  ( ar - > winy / 2 ) * ( 1  +  vec4 [ 1 ] / vec4 [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( fy > - 32700.0  & &  fy < 32700.0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												adr [ 0 ] =  ( short ) floor ( fx ) ;  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												adr [ 1 ] =  ( short ) floor ( fy ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  project_float ( ARegion  * ar ,  float  * vec ,  float  * adr ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									adr [ 0 ] =  IS_CLIPPED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( rv3d - > persmat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  vec4 [ 3 ] > BL_NEAR_CLIP  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  ( float ) ( ar - > winx / 2.0 ) + ( ar - > winx / 2.0 ) * vec4 [ 0 ] / vec4 [ 3 ] ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 1 ]  =  ( float ) ( ar - > winy / 2.0 ) + ( ar - > winy / 2.0 ) * vec4 [ 1 ] / vec4 [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  project_float_noclip ( ARegion  * ar ,  float  * vec ,  float  * adr ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									float  vec4 [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									VECCOPY ( vec4 ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vec4 [ 3 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_v4 ( rv3d - > persmat ,  vec4 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  fabs ( vec4 [ 3 ] )  >  BL_NEAR_CLIP  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  ( float ) ( ar - > winx / 2.0 ) + ( ar - > winx / 2.0 ) * vec4 [ 0 ] / vec4 [ 3 ] ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 1 ]  =  ( float ) ( ar - > winy / 2.0 ) + ( ar - > winy / 2.0 ) * vec4 [ 1 ] / vec4 [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 0 ]  =  ar - > winx  /  2.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										adr [ 1 ]  =  ar - > winy  /  2.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  get_view3d_ortho ( View3D  * v3d ,  RegionView3D  * rv3d ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  Camera  * cam ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  if ( rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									  if ( v3d - > camera  & &  v3d - > camera - > type = = OB_CAMERA )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  cam =  v3d - > camera - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  if ( cam  & &  cam - > type = = CAM_ORTHO ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											  return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  if ( rv3d - > persp = = RV3D_ORTHO ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									  return  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-06 19:46:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* copies logic of get_view3d_viewplane(), keep in sync */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								int  get_view3d_cliprange ( View3D  * v3d ,  RegionView3D  * rv3d ,  float  * clipsta ,  float  * clipend ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  orth =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* clipsta =  v3d - > near ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* clipend =  v3d - > far ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( v3d - > camera )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( v3d - > camera - > type = = OB_LAMP  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Lamp  * la =  v3d - > camera - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipsta =  la - > clipsta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipend =  la - > clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if ( v3d - > camera - > type = = OB_CAMERA )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Camera  * cam =  v3d - > camera - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipsta =  cam - > clipsta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipend =  cam - > clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( cam - > type = = CAM_ORTHO ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													orth =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( rv3d - > persp = = RV3D_ORTHO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										* clipend  * =  0.5 ; 	// otherwise too extreme low zbuffer quality
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										* clipsta =  -  * clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										orth =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  orth ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/* also exposed in previewrender.c */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  get_view3d_viewplane ( View3D  * v3d ,  RegionView3D  * rv3d ,  int  winxi ,  int  winyi ,  rctf  * viewplane ,  float  * clipsta ,  float  * clipend ,  float  * pixsize ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Camera  * cam = NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  lens ,  fac ,  x1 ,  y1 ,  x2 ,  y2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  winx =  ( float ) winxi ,  winy =  ( float ) winyi ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  orth =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									lens =  v3d - > lens ; 	
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* clipsta =  v3d - > near ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* clipend =  v3d - > far ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if ( v3d - > camera )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( v3d - > camera - > type = = OB_LAMP  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												Lamp  * la ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												la =  v3d - > camera - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fac =  cos (  M_PI * la - > spotsize / 360.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												x1 =  saacos ( fac ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												lens =  16.0 * fac / sin ( x1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipsta =  la - > clipsta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipend =  la - > clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if ( v3d - > camera - > type = = OB_CAMERA )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												cam =  v3d - > camera - > data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												lens =  cam - > lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipsta =  cam - > clipsta ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												* clipend =  cam - > clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > persp = = RV3D_ORTHO )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( winx > winy )  x1 =  - rv3d - > dist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  x1 =  - winx * rv3d - > dist / winy ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										x2 =  - x1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( winx > winy )  y1 =  - winy * rv3d - > dist / winx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  y1 =  - rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										y2 =  - y1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										* clipend  * =  0.5 ; 	// otherwise too extreme low zbuffer quality
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										* clipsta =  -  * clipend ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										orth =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* fac for zoom, also used for camdx */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											fac =  ( 1.41421 + (  ( float ) rv3d - > camzoom  ) / 50.0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											fac * =  fac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  fac =  2.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* viewplane size depends... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( cam  & &  cam - > type = = CAM_ORTHO )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* ortho_scale == 1 means exact 1 to 1 mapping */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  dfac =  2.0 * cam - > ortho_scale / fac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( winx > winy )  x1 =  - dfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  x1 =  - winx * dfac / winy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											x2 =  - x1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( winx > winy )  y1 =  - winy * dfac / winx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  y1 =  - dfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											y2 =  - y1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											orth =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  dfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( winx > winy )  dfac =  64.0 / ( fac * winx * lens ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  dfac =  64.0 / ( fac * winy * lens ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											x1 =  -  * clipsta  *  winx * dfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											x2 =  - x1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											y1 =  -  * clipsta  *  winy * dfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											y2 =  - y1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											orth =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* cam view offset */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( cam )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											float  dx =  0.5 * fac * rv3d - > camdx * ( x2 - x1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  dy =  0.5 * fac * rv3d - > camdy * ( y2 - y1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											x1 + =  dx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											x2 + =  dx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											y1 + =  dy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											y2 + =  dy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( pixsize )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  viewfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( orth )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											viewfac =  ( winx  > =  winy ) ?  winx :  winy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											* pixsize =  1.0f / viewfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											viewfac =  ( ( ( winx  > =  winy ) ?  winx :  winy ) * lens ) / 32.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											* pixsize =  * clipsta / viewfac ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									viewplane - > xmin =  x1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									viewplane - > ymin =  y1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									viewplane - > xmax =  x2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									viewplane - > ymax =  y2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  orth ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  setwinmatrixview3d ( ARegion  * ar ,  View3D  * v3d ,  rctf  * rect ) 		/* rect: for picking */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									rctf  viewplane ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  clipsta ,  clipend ,  x1 ,  y1 ,  x2 ,  y2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  orth ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									orth =  get_view3d_viewplane ( v3d ,  rv3d ,  ar - > winx ,  ar - > winy ,  & viewplane ,  & clipsta ,  & clipend ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									//	printf("%d %d %f %f %f %f %f %f\n", winx, winy, viewplane.xmin, viewplane.ymin, viewplane.xmax, viewplane.ymax, clipsta, clipend);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									x1 =  viewplane . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									y1 =  viewplane . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									x2 =  viewplane . xmax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									y2 =  viewplane . ymax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( rect )  { 		/* picking */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rect - > xmin / =  ( float ) ar - > winx ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										rect - > xmin =  x1 + rect - > xmin * ( x2 - x1 ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rect - > ymin / =  ( float ) ar - > winy ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										rect - > ymin =  y1 + rect - > ymin * ( y2 - y1 ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rect - > xmax / =  ( float ) ar - > winx ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										rect - > xmax =  x1 + rect - > xmax * ( x2 - x1 ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rect - > ymax / =  ( float ) ar - > winy ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										rect - > ymax =  y1 + rect - > ymax * ( y2 - y1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 14:14:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( orth )  wmOrtho ( rect - > xmin ,  rect - > xmax ,  rect - > ymin ,  rect - > ymax ,  - clipend ,  clipend ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  wmFrustum ( rect - > xmin ,  rect - > xmax ,  rect - > ymin ,  rect - > ymax ,  clipsta ,  clipend ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 14:14:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( orth )  wmOrtho ( x1 ,  x2 ,  y1 ,  y2 ,  clipsta ,  clipend ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  wmFrustum ( x1 ,  x2 ,  y1 ,  y2 ,  clipsta ,  clipend ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-01 15:32:55 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* update matrix in 3d view region */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									glGetFloatv ( GL_PROJECTION_MATRIX ,  ( float * ) rv3d - > winmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  obmat_to_viewmat ( View3D  * v3d ,  RegionView3D  * rv3d ,  Object  * ob ,  short  smooth ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  bmat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  tmat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d - > view =  0 ;  /* dont show the grid */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									copy_m4_m4 ( bmat ,  ob - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									normalize_m4 ( bmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									invert_m4_m4 ( rv3d - > viewmat ,  bmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* view quat calculation, needed for add object */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									copy_m3_m4 ( tmat ,  rv3d - > viewmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( smooth )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  new_quat [ 4 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( rv3d - > persp = = RV3D_CAMOB  & &  v3d - > camera )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											/* were from a camera view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  orig_ofs [ 3 ] ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											float  orig_dist =  rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											float  orig_lens =  v3d - > lens ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											VECCOPY ( orig_ofs ,  rv3d - > ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* Switch from camera view */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											mat3_to_quat (  new_quat , tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > persp = RV3D_PERSP ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > dist =  0.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											view_settings_from_ob ( v3d - > camera ,  rv3d - > ofs ,  NULL ,  NULL ,  & v3d - > lens ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											smooth_view ( NULL ,  NULL ,  NULL ,  orig_ofs ,  new_quat ,  & orig_dist ,  & orig_lens ) ;  // XXX
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > persp = RV3D_CAMOB ;  /* just to be polite, not needed */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											mat3_to_quat (  new_quat , tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											smooth_view ( NULL ,  NULL ,  NULL ,  NULL ,  new_quat ,  NULL ,  NULL ) ;  // XXX
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mat3_to_quat (  rv3d - > viewquat , tmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# define QUATSET(a, b, c, d, e)	a[0]=b; a[1]=c; a[2]=d; a[3]=e;  
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  view3d_viewlock ( RegionView3D  * rv3d ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch ( rv3d - > view )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									case  RV3D_VIEW_BOTTOM  : 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATSET ( rv3d - > viewquat , 0.0 ,  - 1.0 ,  0.0 ,  0.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									case  RV3D_VIEW_BACK : 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATSET ( rv3d - > viewquat , 0.0 ,  0.0 ,  ( float ) - cos ( M_PI / 4.0 ) ,  ( float ) - cos ( M_PI / 4.0 ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									case  RV3D_VIEW_LEFT : 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATSET ( rv3d - > viewquat , 0.5 ,  - 0.5 ,  0.5 ,  0.5 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									case  RV3D_VIEW_TOP : 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATSET ( rv3d - > viewquat , 1.0 ,  0.0 ,  0.0 ,  0.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									case  RV3D_VIEW_FRONT : 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATSET ( rv3d - > viewquat , ( float ) cos ( M_PI / 4.0 ) ,  ( float ) - sin ( M_PI / 4.0 ) ,  0.0 ,  0.0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									case  RV3D_VIEW_RIGHT : 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATSET ( rv3d - > viewquat ,  0.5 ,  - 0.5 ,  - 0.5 ,  - 0.5 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* give a 4x4 matrix from a perspective view, only needs viewquat, ofs and dist
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  basically  the  same  as . . . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *      rv3d - > persp =  RV3D_PERSP 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *      setviewmatrixview3d ( scene ,  v3d ,  rv3d ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *      setcameratoview3d ( v3d ,  rv3d ,  v3d - > camera ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  . . . but  less  of  a  hassle 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  view3d_persp_mat4 ( RegionView3D  * rv3d ,  float  mat [ ] [ 4 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  qt [ 4 ] ,  dvec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									copy_qt_qt ( qt ,  rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qt [ 0 ] =  - qt [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									quat_to_mat4 ( mat ,  qt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mat [ 3 ] [ 2 ]  - =  rv3d - > dist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									translate_m4 ( mat ,  rv3d - > ofs [ 0 ] ,  rv3d - > ofs [ 1 ] ,  rv3d - > ofs [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mul_v3_v3fl ( dvec ,  mat [ 2 ] ,  - rv3d - > dist ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sub_v3_v3v3 ( mat [ 3 ] ,  dvec ,  rv3d - > ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/* dont set windows active in in here, is used by renderwin too */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  setviewmatrixview3d ( Scene  * scene ,  View3D  * v3d ,  RegionView3D  * rv3d ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > persp = = RV3D_CAMOB )  { 	    /* obs/camera */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if ( v3d - > camera )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-04 14:14:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											where_is_object ( scene ,  v3d - > camera ) ; 	
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											obmat_to_viewmat ( v3d ,  rv3d ,  v3d - > camera ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											quat_to_mat4 (  rv3d - > viewmat , rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											rv3d - > viewmat [ 3 ] [ 2 ] - =  rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 18:31:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* should be moved to better initialize later on XXX */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-20 14:23:32 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( rv3d - > viewlock ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											view3d_viewlock ( rv3d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										quat_to_mat4 (  rv3d - > viewmat , rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( rv3d - > persp = = RV3D_PERSP )  rv3d - > viewmat [ 3 ] [ 2 ] - =  rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if ( v3d - > ob_centre )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											Object  * ob =  v3d - > ob_centre ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  vec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											VECCOPY ( vec ,  ob - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( ob - > type = = OB_ARMATURE  & &  v3d - > ob_centre_bone [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												bPoseChannel  * pchan =  get_pose_channel ( ob - > pose ,  v3d - > ob_centre_bone ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( pchan )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													VECCOPY ( vec ,  pchan - > pose_mat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_m4_v3 ( ob - > obmat ,  vec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											translate_m4 (  rv3d - > viewmat , - vec [ 0 ] ,  - vec [ 1 ] ,  - vec [ 2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										else  translate_m4 (  rv3d - > viewmat , rv3d - > ofs [ 0 ] ,  rv3d - > ofs [ 1 ] ,  rv3d - > ofs [ 2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-18 17:38:21 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* IGLuint-> GLuint*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* Warning: be sure to account for a negative return value
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*    This  is  an  error ,  " Too many objects in select buffer " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*    and  no  action  should  be  taken  ( can  crash  blender )  if  this  happens 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*/ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 16:03:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								short  view3d_opengl_select ( ViewContext  * vc ,  unsigned  int  * buffer ,  unsigned  int  bufsize ,  rcti  * input ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-30 16:03:29 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Scene  * scene =  vc - > scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d =  vc - > v3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar =  vc - > ar ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rctf  rect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  code ,  hits ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-16 15:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									char  dt ,  dtx ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									G . f  | =  G_PICKSEL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* case not a border select */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( input - > xmin = = input - > xmax )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . xmin =  input - > xmin - 12 ; 	// seems to be default value for bones only now
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . xmax =  input - > xmin + 12 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . ymin =  input - > ymin - 12 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-18 14:13:06 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rect . ymax =  input - > ymin + 12 ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . xmin =  input - > xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . xmax =  input - > xmax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . ymin =  input - > ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										rect . ymax =  input - > ymax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									setwinmatrixview3d ( ar ,  v3d ,  & rect ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_m4m4 ( vc - > rv3d - > persmat ,  vc - > rv3d - > viewmat ,  vc - > rv3d - > winmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( v3d - > drawtype  >  OB_WIRE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > zbuf =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										glEnable ( GL_DEPTH_TEST ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( vc - > rv3d - > rflag  &  RV3D_CLIPPING ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										view3d_set_clipping ( vc - > rv3d ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									glSelectBuffer (  bufsize ,  ( GLuint  * ) buffer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									glRenderMode ( GL_SELECT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									glInitNames ( ) ; 	/* these two calls whatfor? It doesnt work otherwise */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									glPushName ( - 1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									code =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 19:10:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( vc - > obedit  & &  vc - > obedit - > type = = OB_MBALL )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 14:14:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										draw_object ( scene ,  ar ,  v3d ,  BASACT ,  DRAW_PICKING | DRAW_CONSTCOLOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if ( ( vc - > obedit  & &  vc - > obedit - > type = = OB_ARMATURE ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-22 00:30:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* if not drawing sketch, draw bones */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( ! BDR_drawSketchNames ( vc ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											draw_object ( scene ,  ar ,  v3d ,  BASACT ,  DRAW_PICKING | DRAW_CONSTCOLOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-22 00:30:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > xray =  TRUE ; 	// otherwise it postpones drawing
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for ( base =  scene - > base . first ;  base ;  base =  base - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( base - > lay  &  v3d - > lay )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( base - > object - > restrictflag  &  OB_RESTRICT_SELECT ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													base - > selcol =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													base - > selcol =  code ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													glLoadName ( code ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 14:14:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													draw_object ( scene ,  ar ,  v3d ,  base ,  DRAW_PICKING | DRAW_CONSTCOLOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* we draw group-duplicators for selection too */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if ( ( base - > object - > transflag  &  OB_DUPLI )  & &  base - > object - > dup_group )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														ListBase  * lb ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														DupliObject  * dob ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														Base  tbase ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														tbase . flag =  OB_FROMDUPLI ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														lb =  object_duplilist ( scene ,  base - > object ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														for ( dob =  lb - > first ;  dob ;  dob =  dob - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															tbase . object =  dob - > ob ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															copy_m4_m4 ( dob - > ob - > obmat ,  dob - > mat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															
							 
						 
					
						
							
								
									
										
										
										
											2010-01-16 15:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															/* extra service: draw the duplicator in drawtype of parent */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															/* MIN2 for the drawtype to allow bounding box objects in groups for lods */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															dt =  tbase . object - > dt ; 	tbase . object - > dt =  MIN2 ( tbase . object - > dt ,  base - > object - > dt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															dtx =  tbase . object - > dtx ;  tbase . object - > dtx =  base - > object - > dtx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 14:14:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															draw_object ( scene ,  ar ,  v3d ,  & tbase ,  DRAW_PICKING | DRAW_CONSTCOLOR ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															
							 
						 
					
						
							
								
									
										
										
										
											2010-01-16 15:17:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															tbase . object - > dt =  dt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															tbase . object - > dtx =  dtx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															copy_m4_m4 ( dob - > ob - > obmat ,  dob - > omat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														free_object_duplilist ( lb ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													code + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 				
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > xray =  FALSE ; 	// restore
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									glPopName ( ) ; 	/* see above (pushname) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hits =  glRenderMode ( GL_RENDER ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									G . f  & =  ~ G_PICKSEL ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									setwinmatrixview3d ( ar ,  v3d ,  NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mul_m4_m4m4 ( vc - > rv3d - > persmat ,  vc - > rv3d - > viewmat ,  vc - > rv3d - > winmat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( v3d - > drawtype  >  OB_WIRE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > zbuf =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										glDisable ( GL_DEPTH_TEST ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								// XXX	persp(PERSP_WIN);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( vc - > rv3d - > rflag  &  RV3D_CLIPPING ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										view3d_clr_clipping ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( hits < 0 )  printf ( " Too many objects in select buffer \n " ) ; 	// XXX make error message
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  hits ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* ********************** local view operator ******************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  unsigned  int  free_localbit ( void ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ScrArea  * sa ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bScreen  * sc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									lay =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* sometimes we loose a localview: when an area is closed */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* check all areas: which localviews are in use? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( sc =  G . main - > screen . first ;  sc ;  sc =  sc - > id . next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for ( sa =  sc - > areabase . first ;  sa ;  sa =  sa - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											SpaceLink  * sl =  sa - > spacedata . first ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for ( ;  sl ;  sl =  sl - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( sl - > spacetype = = SPACE_VIEW3D )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													View3D  * v3d =  ( View3D * )  sl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													lay  | =  v3d - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x01000000 ) = = 0 )  return  0x01000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x02000000 ) = = 0 )  return  0x02000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x04000000 ) = = 0 )  return  0x04000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x08000000 ) = = 0 )  return  0x08000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x10000000 ) = = 0 )  return  0x10000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x20000000 ) = = 0 )  return  0x20000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x40000000 ) = = 0 )  return  0x40000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if (  ( lay  &  0x80000000 ) = = 0 )  return  0x80000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-03 09:49:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  copy_view3d_lock_space ( View3D  * v3d ,  Scene  * scene ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  bit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( v3d - > scenelock  & &  v3d - > localvd = = NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > lay =  scene - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > camera =  scene - > camera ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( v3d - > camera = = NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for ( ar = v3d - > regionbase . first ;  ar ;  ar =  ar - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if ( rv3d - > persp = = RV3D_CAMOB ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														rv3d - > persp =  RV3D_PERSP ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( ( v3d - > lay  &  v3d - > layact )  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for ( bit =  0 ;  bit < 32 ;  bit + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( v3d - > lay  &  ( 1 < < bit ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													v3d - > layact =  1 < < bit ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-03-27 11:54:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  ED_view3d_scene_layers_copy ( struct  View3D  * v3d ,  struct  Scene  * scene ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									copy_view3d_lock_space ( v3d ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-03 09:49:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  ED_view3d_scene_layers_update ( Main  * bmain ,  Scene  * scene ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bScreen  * sc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ScrArea  * sa ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SpaceLink  * sl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* from scene copy to the other views */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( sc = bmain - > screen . first ;  sc ;  sc = sc - > id . next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( sc - > scene ! = scene ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for ( sa = sc - > areabase . first ;  sa ;  sa = sa - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for ( sl = sa - > spacedata . first ;  sl ;  sl = sl - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( sl - > spacetype = = SPACE_VIEW3D ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													copy_view3d_lock_space ( ( View3D * ) sl ,  scene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								int  ED_view3d_scene_layer_set ( int  lay ,  const  int  * values ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  i ,  tot =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* ensure we always have some layer selected */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( i = 0 ;  i < 20 ;  i + + ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( values [ i ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tot + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( tot = = 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( i = 0 ;  i < 20 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( values [ i ] )  lay  | =  ( 1 < < i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  lay  & =  ~ ( 1 < < i ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  initlocalview ( Scene  * scene ,  ScrArea  * sa ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									View3D  * v3d =  sa - > spacedata . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Base  * base ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  size  =  0.0 ,  min [ 3 ] ,  max [ 3 ] ,  box [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unsigned  int  locallay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  ok = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( v3d - > localvd )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									INIT_MINMAX ( min ,  max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									locallay =  free_localbit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( locallay = = 0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-17 21:44:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										printf ( " Sorry, no more than 8 localviews \n " ) ; 	// XXX error 
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ok =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 19:10:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( scene - > obedit )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minmax_object ( scene - > obedit ,  min ,  max ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ok =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											BASACT - > lay  | =  locallay ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 19:10:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											scene - > obedit - > lay =  BASACT - > lay ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											for ( base =  FIRSTBASE ;  base ;  base =  base - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-20 18:43:21 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if ( TESTBASE ( v3d ,  base ) )   { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													minmax_object ( base - > object ,  min ,  max ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													base - > lay  | =  locallay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													base - > object - > lay =  base - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ok =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										box [ 0 ] =  ( max [ 0 ] - min [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										box [ 1 ] =  ( max [ 1 ] - min [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										box [ 2 ] =  ( max [ 2 ] - min [ 2 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										size =  MAX3 ( box [ 0 ] ,  box [ 1 ] ,  box [ 2 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( size < = 0.01 )  size =  0.01 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ok )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										v3d - > localvd =  MEM_mallocN ( sizeof ( View3D ) ,  " localview " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										memcpy ( v3d - > localvd ,  v3d ,  sizeof ( View3D ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for ( ar =  sa - > regionbase . first ;  ar ;  ar =  ar - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												rv3d - > localvd =  MEM_mallocN ( sizeof ( RegionView3D ) ,  " localview region " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												memcpy ( rv3d - > localvd ,  rv3d ,  sizeof ( RegionView3D ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > ofs [ 0 ] =  - ( min [ 0 ] + max [ 0 ] ) / 2.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > ofs [ 1 ] =  - ( min [ 1 ] + max [ 1 ] ) / 2.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > ofs [ 2 ] =  - ( min [ 2 ] + max [ 2 ] ) / 2.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > dist =  size ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* perspective should be a bit farther away to look nice */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if ( rv3d - > persp = = RV3D_ORTHO ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													rv3d - > dist * =  0.7 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												// correction for window aspect ratio
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( ar - > winy > 2  & &  ar - > winx > 2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													float  asp =  ( float ) ar - > winx / ( float ) ar - > winy ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if ( asp < 1.0 )  asp =  1.0 / asp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													rv3d - > dist * =  asp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( rv3d - > persp = = RV3D_CAMOB )  rv3d - > persp =  RV3D_PERSP ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												v3d - > cursor [ 0 ] =  - rv3d - > ofs [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												v3d - > cursor [ 1 ] =  - rv3d - > ofs [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												v3d - > cursor [ 2 ] =  - rv3d - > ofs [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( v3d - > near >  0.1 )  v3d - > near =  0.1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > lay =  locallay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* clear flags */  
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for ( base =  FIRSTBASE ;  base ;  base =  base - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if (  base - > lay  &  locallay  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												base - > lay - =  locallay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( base - > lay = = 0 )  base - > lay =  v3d - > layact ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 19:10:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if ( base - > object  ! =  scene - > obedit )  base - > flag  | =  SELECT ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												base - > object - > lay =  base - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 		
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  restore_localviewdata ( ScrArea  * sa ,  int  free ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d =  sa - > spacedata . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( v3d - > localvd = = NULL )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									v3d - > near =  v3d - > localvd - > near ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									v3d - > far =  v3d - > localvd - > far ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									v3d - > lay =  v3d - > localvd - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									v3d - > layact =  v3d - > localvd - > layact ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									v3d - > drawtype =  v3d - > localvd - > drawtype ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									v3d - > camera =  v3d - > localvd - > camera ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( free )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MEM_freeN ( v3d - > localvd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										v3d - > localvd =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									for ( ar =  sa - > regionbase . first ;  ar ;  ar =  ar - > next )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( ar - > regiontype  = =  RGN_TYPE_WINDOW )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											RegionView3D  * rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( rv3d - > localvd )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > dist =  rv3d - > localvd - > dist ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												VECCOPY ( rv3d - > ofs ,  rv3d - > localvd - > ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												QUATCOPY ( rv3d - > viewquat ,  rv3d - > localvd - > viewquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > view =  rv3d - > localvd - > view ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > persp =  rv3d - > localvd - > persp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												rv3d - > camzoom =  rv3d - > localvd - > camzoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( free )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													MEM_freeN ( rv3d - > localvd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													rv3d - > localvd =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  endlocalview ( Scene  * scene ,  ScrArea  * sa ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									View3D  * v3d =  sa - > spacedata . first ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  Base  * base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  locallay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( v3d - > localvd )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										locallay =  v3d - > lay  &  0xFF000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										restore_localviewdata ( sa ,  1 ) ;  // 1 = free
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* for when in other window the layers have changed */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( v3d - > scenelock )  v3d - > lay =  scene - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for ( base =  FIRSTBASE ;  base ;  base =  base - > next )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if (  base - > lay  &  locallay  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												base - > lay - =  locallay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( base - > lay = = 0 )  base - > lay =  v3d - > layact ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-01-02 19:10:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if ( base - > object  ! =  scene - > obedit )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													base - > flag  | =  SELECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													base - > object - > flag  | =  SELECT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												base - > object - > lay =  base - > lay ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  localview_exec ( bContext  * C ,  wmOperator  * unused ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( v3d - > localvd ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										endlocalview ( CTX_data_scene ( C ) ,  CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										initlocalview ( CTX_data_scene ( C ) ,  CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  VIEW3D_OT_localview ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name =  " Local View " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description =  " Toggle display of selected object(s) separately and centered in view " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname =  " VIEW3D_OT_localview " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec =  localview_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll =  ED_operator_view3d_active ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-16 04:45:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if GAMEBLENDER == 1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  ListBase  queue_back ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  SaveState ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									wmWindow  * win =  CTX_wm_window ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-16 01:25:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Object  * obact  =  CTX_data_active_object ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									glPushAttrib ( GL_ALL_ATTRIB_BITS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-16 01:25:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( obact  & &  obact - > mode  &  OB_MODE_TEXTURE_PAINT ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										GPU_paint_set_mipmap ( 1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									queue_back =  win - > queue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									win - > queue . first =  win - > queue . last =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									//XXX waitcursor(1);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  RestoreState ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									wmWindow  * win =  CTX_wm_window ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-16 01:25:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Object  * obact  =  CTX_data_active_object ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-08-16 01:25:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( obact  & &  obact - > mode  &  OB_MODE_TEXTURE_PAINT ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										GPU_paint_set_mipmap ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX curarea->win_swap = 0;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX curarea->head_swap=0;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX allqueue(REDRAWVIEW3D, 1);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX allqueue(REDRAWBUTSALL, 0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX reset_slowparents();
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX waitcursor(0);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX G.qual= 0;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									win - > queue =  queue_back ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-09-21 21:37:19 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									GPU_state_init ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									glPopAttrib ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-02 01:39:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* was space_set_commmandline_options in 2.4x */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  game_set_commmandline_options ( GameData  * gm ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SYS_SystemHandle  syshandle ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  test ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  (  ( syshandle  =  SYS_GetSystem ( ) )  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* User defined settings */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( U . gameflags  &  USER_DISABLE_MIPMAP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										GPU_set_mipmap ( ! test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " nomipmap " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* File specific settings: */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Only test the first one. These two are switched
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  simultaneously .  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > flag  &  GAME_SHOW_FRAMERATE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " show_framerate " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " show_profile " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-19 14:48:35 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										test  =  ( gm - > flag  &  GAME_SHOW_DEBUG_PROPS ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-02 01:39:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " show_properties " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > flag  &  GAME_SHOW_PHYSICS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " show_physics " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > flag  &  GAME_ENABLE_ALL_FRAMES ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " fixedtime " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-22 12:25:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										test =  ( gm - > flag  &  GAME_ENABLE_ANIMATION_RECORD ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " animation_record " ,  test ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-02 01:39:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > flag  &  GAME_IGNORE_DEPRECATION_WARNINGS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " ignore_deprecation_warnings " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > matmode  = =  GAME_MAT_MULTITEX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " blender_material " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > matmode  = =  GAME_MAT_GLSL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " blender_glsl_material " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										test =  ( gm - > flag  &  GAME_DISPLAY_LISTS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										SYS_WriteCommandLineInt ( syshandle ,  " displaylists " ,  test ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* maybe we need this defined somewhere else */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 00:25:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								extern  void  StartKetsjiShell ( struct  bContext  * C ,  struct  ARegion  * ar ,  rcti  * cam_frame ,  int  always_use_expand_framing ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-07-16 04:45:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif  // GAMEBLENDER == 1
 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-08-27 15:22:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  game_engine_poll ( bContext  * C ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-05 07:42:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* we need a context and area to launch BGE
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									it ' s  a  temporary  solution  to  avoid  crash  at  load  time 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  we  try  to  auto  run  the  BGE .  Ideally  we  want  the 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									context  to  be  set  as  soon  as  we  load  the  file .  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( CTX_wm_window ( C ) = = NULL )  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( CTX_wm_screen ( C ) = = NULL )  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( CTX_wm_area ( C ) = = NULL )  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( CTX_data_mode_enum ( C ) ! = CTX_MODE_OBJECT ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-08-27 15:22:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  ED_view3d_context_activate ( bContext  * C ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									bScreen  * sc =  CTX_wm_screen ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ScrArea  * sa =  CTX_wm_area ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( sa - > spacetype  ! =  SPACE_VIEW3D ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										for ( sa = sc - > areabase . first ;  sa ;  sa =  sa - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( sa - > spacetype = = SPACE_VIEW3D ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ! sa ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for ( ar = sa - > regionbase . first ;  ar ;  ar = ar - > next ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( ar - > regiontype  = =  RGN_TYPE_WINDOW ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ! ar ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-28 16:31:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// bad context switch ..
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CTX_wm_area_set ( C ,  sa ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CTX_wm_region_set ( C ,  ar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d =  ar - > regiondata ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-06 20:59:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  game_engine_exec ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# if GAMEBLENDER == 1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * startscene  =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ScrArea  * sa ,  * prevsa =  CTX_wm_area ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar ,  * prevar =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 14:16:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									wmWindow  * prevwin =  CTX_wm_window ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-28 18:03:04 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rcti  cam_frame ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// bad context switch ..
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( ! ED_view3d_context_activate ( C ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sa =  CTX_wm_area ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ar =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-28 16:31:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									view3d_operator_needs_opengl ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-09-02 01:39:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									game_set_commmandline_options ( & startscene - > gm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-16 02:52:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( rv3d - > persp = = RV3D_CAMOB  & &  startscene - > gm . framing . type  = =  SCE_GAMEFRAMING_BARS  & &  startscene - > gm . stereoflag  ! =  STEREO_DOME )  {  /* Letterbox */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 00:25:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rctf  cam_framef ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-04-16 02:14:56 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										calc_viewborder ( startscene ,  ar ,  rv3d ,  CTX_wm_view3d ( C ) ,  & cam_framef ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 00:25:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										cam_frame . xmin  =  cam_framef . xmin  +  ar - > winrct . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . xmax  =  cam_framef . xmax  +  ar - > winrct . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . ymin  =  cam_framef . ymin  +  ar - > winrct . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . ymax  =  cam_framef . ymax  +  ar - > winrct . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BLI_isect_rcti ( & ar - > winrct ,  & cam_frame ,  & cam_frame ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . xmin  =  ar - > winrct . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . xmax  =  ar - > winrct . xmax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . ymin  =  ar - > winrct . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cam_frame . ymax  =  ar - > winrct . ymax ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									SaveState ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 14:16:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 00:25:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									StartKetsjiShell ( C ,  ar ,  & cam_frame ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 14:16:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* restore context, in case it changed in the meantime, for
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									   example  by  working  in  another  window  or  closing  it  */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									CTX_wm_region_set ( C ,  prevar ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 14:16:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									CTX_wm_window_set ( C ,  prevwin ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-20 18:47:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									CTX_wm_area_set ( C ,  prevsa ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-14 14:16:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									RestoreState ( C ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-07-23 21:35:11 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									//XXX restore_all_scene_cfra(scene_cfra_store);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									set_scene_bg ( startscene ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									//XXX scene_update_for_newframe(G.scene, G.scene->lay);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 20:58:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ED_area_tag_redraw ( CTX_wm_area ( C ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-06 17:38:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-06 17:38:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# else 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									BKE_report ( op - > reports ,  RPT_ERROR ,  " Game engine is disabled in this build. " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  VIEW3D_OT_game_start ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name =  " Start Game Engine " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description =  " Start game engine " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname =  " VIEW3D_OT_game_start " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > exec =  game_engine_exec ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-08-27 15:22:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > poll =  game_engine_poll ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-06-13 17:25:54 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_CANCEL			1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_CONFIRM			2 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_ACCELERATE 		3 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DECELERATE		4 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_PAN_ENABLE		5 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_PAN_DISABLE		6 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DIR_FORWARD		7 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DIR_BACKWARD		8 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DIR_LEFT			9 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DIR_RIGHT			10 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DIR_UP			11 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_DIR_DOWN			12 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_AXIS_LOCK_X		13 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_AXIS_LOCK_Z		14 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_PRECISION_ENABLE	15 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_MODAL_PRECISION_DISABLE	16 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* called in transform_ops.c, on each regeneration of keymaps  */ 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
  or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
  to .py files as well to make creating distributable configurations
  easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
  keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
  added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
											 
										 
										
											2009-10-08 18:40:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  fly_modal_keymap ( wmKeyConfig  * keyconf ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									static  EnumPropertyItem  modal_items [ ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_CANCEL , 	" CANCEL " ,  0 ,  " Cancel " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_CONFIRM , 	" CONFIRM " ,  0 ,  " Confirm " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_ACCELERATE ,  " ACCELERATE " ,  0 ,  " Accelerate " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DECELERATE ,  " DECELERATE " ,  0 ,  " Decelerate " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_PAN_ENABLE , 	" PAN_ENABLE " ,  0 ,  " Pan Enable " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_PAN_DISABLE , 	" PAN_DISABLE " ,  0 ,  " Pan Disable " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DIR_FORWARD , 	" FORWARD " ,  0 ,  " Fly Forward " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DIR_BACKWARD , " BACKWARD " ,  0 ,  " Fly Backward " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DIR_LEFT , 	" LEFT " ,  0 ,  " Fly Left " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DIR_RIGHT , 	" RIGHT " ,  0 ,  " Fly Right " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DIR_UP , 		" UP " ,  0 ,  " Fly Up " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_DIR_DOWN , 	" DOWN " ,  0 ,  " Fly Down " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_AXIS_LOCK_X , 	" AXIS_LOCK_X " ,  0 ,  " X Axis Correction " ,  " X axis correction (toggle) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_AXIS_LOCK_Z , 	" AXIS_LOCK_Z " ,  0 ,  " X Axis Correction " ,  " Z axis correction (toggle) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_PRECISION_ENABLE , 	" PRECISION_ENABLE " ,  0 ,  " Precision Enable " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ FLY_MODAL_PRECISION_DISABLE , 	" PRECISION_DISABLE " ,  0 ,  " Precision Disable " ,  " " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 ,  NULL ,  0 ,  NULL ,  NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
  or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
  to .py files as well to make creating distributable configurations
  easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
  keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
  added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
											 
										 
										
											2009-10-08 18:40:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									wmKeyMap  * keymap =  WM_modalkeymap_get ( keyconf ,  " View3D Fly Modal " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* this function is called for each spacetype, only needs to add map once */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( keymap )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
  or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
  to .py files as well to make creating distributable configurations
  easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
  keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
  added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
											 
										 
										
											2009-10-08 18:40:03 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									keymap =  WM_modalkeymap_add ( keyconf ,  " View3D Fly Modal " ,  modal_items ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* items for modal map */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  ESCKEY ,     KM_PRESS ,  KM_ANY ,  0 ,  FLY_MODAL_CANCEL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  RIGHTMOUSE ,  KM_ANY ,  KM_ANY ,  0 ,  FLY_MODAL_CANCEL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  LEFTMOUSE ,  KM_ANY ,  KM_ANY ,  0 ,  FLY_MODAL_CONFIRM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  RETKEY ,  KM_PRESS ,  KM_ANY ,  0 ,  FLY_MODAL_CONFIRM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-23 16:40:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  SPACEKEY ,  KM_PRESS ,  KM_ANY ,  0 ,  FLY_MODAL_CONFIRM ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  PADENTER ,  KM_PRESS ,  KM_ANY ,  0 ,  FLY_MODAL_CONFIRM ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  PADPLUSKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_ACCELERATE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  PADMINUS ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DECELERATE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  WHEELUPMOUSE ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_ACCELERATE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  WHEELDOWNMOUSE ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DECELERATE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  MIDDLEMOUSE ,  KM_PRESS ,  KM_ANY ,  0 ,  FLY_MODAL_PAN_ENABLE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  MIDDLEMOUSE ,  KM_RELEASE ,  KM_ANY ,  0 ,  FLY_MODAL_PAN_DISABLE ) ;  /* XXX - Bug in the event system, middle mouse release doesnt work */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* WASD */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  WKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DIR_FORWARD ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  SKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DIR_BACKWARD ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  AKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DIR_LEFT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  DKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DIR_RIGHT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  RKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DIR_UP ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  FKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_DIR_DOWN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  XKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_AXIS_LOCK_X ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  ZKEY ,  KM_PRESS ,  0 ,  0 ,  FLY_MODAL_AXIS_LOCK_Z ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  LEFTSHIFTKEY ,  KM_PRESS ,  KM_ANY ,  0 ,  FLY_MODAL_PRECISION_ENABLE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_add_item ( keymap ,  LEFTSHIFTKEY ,  KM_RELEASE ,  KM_ANY ,  0 ,  FLY_MODAL_PRECISION_DISABLE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* assign map to operators */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_modalkeymap_assign ( keymap ,  " VIEW3D_OT_fly " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								typedef  struct  FlyInfo  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* context stuff */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									wmTimer  * timer ;  /* needed for redraws */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  state ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  use_precision ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  redraw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  mval [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* fly state state */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  speed ;  /* the speed the view is moving per redraw */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  axis ;  /* Axis index to move allong by default Z to move allong the view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  pan_view ;  /* when true, pan the view instead of rotating */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* relative view axis locking - xlock, zlock
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									0 ;  disabled 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									1 ;  enabled  but  not  checking  because  mouse  hasnt  moved  outside  the  margin  since  locking  was  checked  an  not  needed 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									   when  the  mouse  moves ,  locking  is  set  to  2  so  checks  are  done . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									2 ;  mouse  moved  and  checking  needed ,  if  no  view  altering  is  donem  its  changed  back  to  1  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  xlock ,  zlock ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  xlock_momentum ,  zlock_momentum ;  /* nicer dynamics */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  grid ;  /* world scale 1.0 default */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* root most parent */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Object  * root_parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* backup values */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  dist_backup ;  /* backup the views distance since we use a zero dist for fly mode */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  ofs_backup [ 3 ] ;  /* backup the views offset incase the user cancels flying in non camera mode */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  rot_backup [ 4 ] ;  /* backup the views quat incase the user cancels flying in non camera mode. (quat for view, eul for camera) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									short  persp_backup ;  /* remember if were ortho or not, only used for restoring the view if it was a ortho view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									void  * obtfm ;  /* backup the objects transform */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* compare between last state */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									double  time_lastwheel ;  /* used to accelerate when using the mousewheel a lot */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									double  time_lastdraw ;  /* time between draws */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* use for some lag */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  dvec_prev [ 3 ] ;  /* old for some lag */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}  FlyInfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* FlyInfo->state */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_RUNNING		0 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_CANCEL		1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define FLY_CONFIRM		2 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-19 10:27:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  initFlyInfo  ( bContext  * C ,  FlyInfo  * fly ,  wmOperator  * op ,  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  upvec [ 3 ] ;  // tmp
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  mat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > v3d  =  CTX_wm_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > ar  =  CTX_wm_region ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > scene =  CTX_data_scene ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( fly - > rv3d - > persp = = RV3D_CAMOB  & &  fly - > v3d - > camera - > id . lib )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Cannot fly a camera from an external library " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( fly - > v3d - > ob_centre )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Cannot fly when the view is locked to an object " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( fly - > rv3d - > persp = = RV3D_CAMOB  & &  fly - > v3d - > camera - > constraints . first )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										BKE_report ( op - > reports ,  RPT_ERROR ,  " Cannot fly an object with constraints " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > state =  FLY_RUNNING ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > speed =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > axis =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > pan_view =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > xlock =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > zlock =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > xlock_momentum = 0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > zlock_momentum = 0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > grid =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > use_precision =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > dvec_prev [ 0 ] =  fly - > dvec_prev [ 1 ] =  fly - > dvec_prev [ 2 ] =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-20 13:58:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									fly - > timer =  WM_event_add_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  TIMER ,  0.01f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > mval [ 0 ]  =  event - > x  -  fly - > ar - > winrct . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > mval [ 1 ]  =  event - > y  -  fly - > ar - > winrct . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > time_lastdraw =  fly - > time_lastwheel =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-25 14:13:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									fly - > rv3d - > rflag  | =  RV3D_FLYMODE | RV3D_NAVIGATING ;  /* so we draw the corner margins */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* detect weather to start with Z locking */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									upvec [ 0 ] = 1.0f ;  upvec [ 1 ] = 0.0f ;  upvec [ 2 ] = 0.0f ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									copy_m3_m4 ( mat ,  fly - > rv3d - > viewinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( fabs ( upvec [ 2 ] )  <  0.1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fly - > zlock  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									upvec [ 0 ] = 0 ;  upvec [ 1 ] = 0 ;  upvec [ 2 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > persp_backup =  fly - > rv3d - > persp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > dist_backup =  fly - > rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( fly - > rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										Object  * ob_back ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( ( fly - > root_parent = fly - > v3d - > camera - > parent ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while ( fly - > root_parent - > parent ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > root_parent =  fly - > root_parent - > parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ob_back =  fly - > root_parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ob_back =  fly - > v3d - > camera ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* store the original camera loc and rot */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* TODO. axis angle etc */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fly - > obtfm =  object_tfm_backup ( ob_back ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										where_is_object ( fly - > scene ,  fly - > v3d - > camera ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 09:02:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										negate_v3_v3 ( fly - > rv3d - > ofs ,  fly - > v3d - > camera - > obmat [ 3 ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fly - > rv3d - > dist = 0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* perspective or ortho */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( fly - > rv3d - > persp = = RV3D_ORTHO ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fly - > rv3d - > persp =  RV3D_PERSP ;  /*if ortho projection, make perspective */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QUATCOPY ( fly - > rot_backup ,  fly - > rv3d - > viewquat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( fly - > ofs_backup ,  fly - > rv3d - > ofs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fly - > rv3d - > dist =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										upvec [ 2 ] =  fly - > dist_backup ;  /*x and y are 0*/ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										sub_v3_v3v3 ( fly - > rv3d - > ofs ,  fly - > rv3d - > ofs ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/*Done with correcting for the dist*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-08 20:14:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* center the mouse, probably the UI mafia are against this but without its quite annoying */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_cursor_warp ( CTX_wm_window ( C ) ,  fly - > ar - > winrct . xmin  +  fly - > ar - > winx / 2 ,  fly - > ar - > winrct . ymin  +  fly - > ar - > winy / 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  flyEnd ( bContext  * C ,  FlyInfo  * fly ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  fly - > rv3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  fly - > v3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  upvec [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( fly - > state  = =  FLY_RUNNING ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-20 13:58:53 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									WM_event_remove_timer ( CTX_wm_manager ( C ) ,  CTX_wm_window ( C ) ,  fly - > timer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									rv3d - > dist =  fly - > dist_backup ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( fly - > state  = =  FLY_CANCEL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Revert to original view? */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( fly - > persp_backup = = RV3D_CAMOB )  {  /* a camera view */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											Object  * ob_back ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if ( fly - > root_parent ) ob_back =  fly - > root_parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else 				ob_back =  fly - > v3d - > camera ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-12-07 00:50:40 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											/* store the original camera loc and rot */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											object_tfm_restore ( ob_back ,  fly - > obtfm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											DAG_id_flush_update ( & ob_back - > id ,  OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* Non Camera we need to reset the view back to the original location bacause the user canceled*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QUATCOPY ( rv3d - > viewquat ,  fly - > rot_backup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											VECCOPY ( rv3d - > ofs ,  fly - > ofs_backup ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											rv3d - > persp =  fly - > persp_backup ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									else  if  ( fly - > persp_backup = = RV3D_CAMOB )  { 	/* camera */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  mat3 [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if ( fly - > root_parent )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											DAG_id_flush_update ( & fly - > root_parent - > id ,  OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											copy_m3_m4 ( mat3 ,  v3d - > camera - > obmat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											object_mat3_to_rot ( v3d - > camera ,  mat3 ,  TRUE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											DAG_id_flush_update ( & v3d - > camera - > id ,  OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0  //XXX2.5
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( IS_AUTOKEY_MODE ( NORMAL ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											allqueue ( REDRAWIPO ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											allspace ( REMAKEIPO ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											allqueue ( REDRAWNLA ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											allqueue ( REDRAWTIME ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  {  /* not camera */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Apply the fly mode view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/*restore the dist*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  mat [ 3 ] [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										upvec [ 0 ] =  upvec [ 1 ] =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										upvec [ 2 ] =  fly - > dist_backup ;  /*x and y are 0*/ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										copy_m3_m4 ( mat ,  rv3d - > viewinv ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										add_v3_v3v3 ( rv3d - > ofs ,  rv3d - > ofs ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/*Done with correcting for the dist */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-25 14:13:43 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d - > rflag  & =  ~ ( RV3D_FLYMODE | RV3D_NAVIGATING ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								//XXX2.5	BIF_view3d_previewrender_signal(fly->sa, PR_DBASE|PR_DISPRECT); /* not working at the moment not sure why */
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( fly - > obtfm ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MEM_freeN ( fly - > obtfm ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( fly - > state  = =  FLY_CONFIRM )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MEM_freeN ( fly ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									MEM_freeN ( fly ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-12-19 10:27:23 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  flyEvent ( FlyInfo  * fly ,  wmEvent  * event ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-27 12:43:48 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( event - > type  = =  TIMER  & &  event - > customdata  = =  fly - > timer )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										fly - > redraw  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( event - > type  = =  MOUSEMOVE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fly - > mval [ 0 ]  =  event - > x  -  fly - > ar - > winrct . xmin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fly - > mval [ 1 ]  =  event - > y  -  fly - > ar - > winrct . ymin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  /* handle modal keymap first */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( event - > type  = =  EVT_MODAL_MAP )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										switch  ( event - > val )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_CANCEL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > state  =  FLY_CANCEL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_CONFIRM : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > state  =  FLY_CONFIRM ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_ACCELERATE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												double  time_currwheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												float  time_wheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												time_currwheel =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												time_wheel  =  ( float ) ( time_currwheel  -  fly - > time_lastwheel ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > time_lastwheel  =  time_currwheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/*printf("Wheel %f\n", time_wheel);*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/*Mouse wheel delays range from 0.5==slow to 0.01==fast*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												time_wheel  =  1 +  ( 10  -  ( 20 * MIN2 ( time_wheel ,  0.5 ) ) ) ;  /* 0-0.5 -> 0-5.0 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > speed < 0.0f )  fly - > speed =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( event - > shift ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > speed + =  fly - > grid * time_wheel * 0.1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > speed + =  fly - > grid * time_wheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DECELERATE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												double  time_currwheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												float  time_wheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												time_currwheel =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												time_wheel  =  ( float ) ( time_currwheel  -  fly - > time_lastwheel ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > time_lastwheel  =  time_currwheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												time_wheel  =  1 +  ( 10  -  ( 20 * MIN2 ( time_wheel ,  0.5 ) ) ) ;  /* 0-0.5 -> 0-5.0 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > speed > 0 )  fly - > speed = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( event - > shift ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > speed - =  fly - > grid * time_wheel * 0.1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > speed - =  fly - > grid * time_wheel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_PAN_ENABLE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > pan_view =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_PAN_DISABLE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//XXX2.5		warp_pointer(cent_orig[0], cent_orig[1]);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > pan_view =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* impliment WASD keys */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DIR_FORWARD : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > speed  <  0.0f )  fly - > speed =  - fly - > speed ;  /* flip speed rather then stopping, game like motion */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  fly - > speed  + =  fly - > grid ;  /* increse like mousewheel if were alredy moving in that difection*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > axis =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DIR_BACKWARD : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > speed > 0 )  fly - > speed =  - fly - > speed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  fly - > speed  - =  fly - > grid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > axis =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DIR_LEFT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > speed  <  0.0f )  fly - > speed =  - fly - > speed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > axis =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DIR_RIGHT : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > speed  >  0.0f )  fly - > speed =  - fly - > speed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > axis =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DIR_UP : 
							 
						 
					
						
							
								
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											 
										 
										
											2010-03-20 16:41:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( fly - > speed  >  0.0f )  fly - > speed =  - fly - > speed ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												fly - > axis =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_DIR_DOWN : 
							 
						 
					
						
							
								
									
										
										
											
												merge own commits into render branch into trunk since 27560
27562, 27570, 27571, 27574, 27576, 27577, 27579, 27590, 27591, 27594, 27595, 27596, 27599, 27605, 27611, 27612, 27613, 27614, 27623
											 
										 
										
											2010-03-20 16:41:01 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( fly - > speed  <  0.0f )  fly - > speed =  - fly - > speed ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												fly - > axis =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_AXIS_LOCK_X : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > xlock )  fly - > xlock = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													fly - > xlock  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													fly - > xlock_momentum  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_AXIS_LOCK_Z : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > zlock )  fly - > zlock = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													fly - > zlock  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													fly - > zlock_momentum  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_PRECISION_ENABLE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > use_precision =  TRUE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  FLY_MODAL_PRECISION_DISABLE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > use_precision =  FALSE ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  flyApply ( bContext  * C ,  FlyInfo  * fly ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly  mode  -  Shift + F 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									a  fly  loop  where  the  user  can  move  move  the  view  as  if  they  are  flying 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  fly - > rv3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									View3D  * v3d  =  fly - > v3d ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ARegion  * ar  =  fly - > ar ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Scene  * scene =  fly - > scene ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  prev_view_mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									float  mat [ 3 ] [ 3 ] ,  /* 3x3 copy of the view matrix so we can move allong the view axis */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									dvec [ 3 ] = { 0 , 0 , 0 } ,  /* this is the direction thast added to the view offset per redraw */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Camera Uprighting variables */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									upvec [ 3 ] = { 0 , 0 , 0 } ,  /* stores the view's up vector */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									moffset [ 2 ] ,  /* mouse offset from the views center */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tmp_quat [ 4 ] ;  /* used for rotating the view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  cent_orig [ 2 ] ,  /* view center */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								//XXX- can avoid using // 	cent[2], /* view center modified */
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									xmargin ,  ymargin ;  /* x and y margin are define the safe area where the mouses movement wont rotate the view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  char 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									apply_rotation =  1 ;  /* if the user presses shift they can look about without movinf the direction there looking*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( fly - > root_parent ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										view3d_persp_mat4 ( rv3d ,  prev_view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* the dist defines a vector that is infront of the offset
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									to  rotate  the  view  about . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									this  is  no  good  for  fly  mode  because  we 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									want  to  rotate  about  the  viewers  center . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									but  to  correct  the  dist  removal  we  must 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									alter  offset  so  the  view  doesn ' t  jump .  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									xmargin =  ar - > winx / 20.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ymargin =  ar - > winy / 20.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									cent_orig [ 0 ] =  ar - > winrct . xmin  +  ar - > winx / 2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									cent_orig [ 1 ] =  ar - > winrct . ymin  +  ar - > winy / 2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* mouse offset from the center */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										moffset [ 0 ] =  fly - > mval [ 0 ] -  ar - > winx / 2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										moffset [ 1 ] =  fly - > mval [ 1 ] -  ar - > winy / 2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* enforce a view margin */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( moffset [ 0 ] > xmargin ) 			moffset [ 0 ] - = xmargin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( moffset [ 0 ]  <  - xmargin ) 	moffset [ 0 ] + = xmargin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 							moffset [ 0 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( moffset [ 1 ] > ymargin ) 			moffset [ 1 ] - = ymargin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( moffset [ 1 ]  <  - ymargin ) 	moffset [ 1 ] + = ymargin ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 							moffset [ 1 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* scale the mouse movement by this value - scales mouse movement to the view size
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  moffset [ 0 ] / ( ar - > winx - xmargin * 2 )  -  window  size  minus  margin  ( same  for  y ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  the  mouse  moves  isnt  linear  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( moffset [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											moffset [ 0 ]  / =  ar - > winx  -  ( xmargin * 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											moffset [ 0 ]  * =  fabs ( moffset [ 0 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( moffset [ 1 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											moffset [ 1 ]  / =  ar - > winy  -  ( ymargin * 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											moffset [ 1 ]  * =  fabs ( moffset [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Should we redraw? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if ( fly - > speed  ! =  0.0f  | |  moffset [ 0 ]  | |  moffset [ 1 ]  | |  fly - > zlock  | |  fly - > xlock  | |  dvec [ 0 ]  | |  dvec [ 1 ]  | |  dvec [ 2 ]  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  dvec_tmp [ 3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											double  time_current ,  time_redraw ;  /*time how fast it takes for us to redraw, this is so simple scenes dont fly too fast */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											float  time_redraw_clamped ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											time_current =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											time_redraw =  ( float ) ( time_current  -  fly - > time_lastdraw ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											time_redraw_clamped =  MIN2 ( 0.05f ,  time_redraw ) ;  /* clamt the redraw time to avoid jitter in roll correction */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fly - > time_lastdraw =  time_current ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/*fprintf(stderr, "%f\n", time_redraw);*/  /* 0.002 is a small redraw 0.02 is larger */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* Scale the time to use shift to scale the speed down- just like
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											shift  slows  many  other  areas  of  blender  down  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( fly - > use_precision ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												fly - > speed =  fly - > speed  *  ( 1.0f - time_redraw_clamped ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											copy_m3_m4 ( mat ,  rv3d - > viewinv ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( fly - > pan_view = = TRUE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* pan only */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												dvec_tmp [ 0 ] =  - moffset [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												dvec_tmp [ 1 ] =  - moffset [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												dvec_tmp [ 2 ] =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > use_precision )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													dvec_tmp [ 0 ]  * =  0.1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													dvec_tmp [ 1 ]  * =  0.1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												mul_m3_v3 ( mat ,  dvec_tmp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												mul_v3_fl ( dvec_tmp ,  time_redraw * 200.0  *  fly - > grid ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												float  roll ;  /* similar to the angle between the camera's up and the Z-up, but its very rough so just roll*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* rotate about the X axis- look up/down */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( moffset [ 1 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 0 ] = 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 1 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 2 ] = 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													axis_angle_to_quat (  tmp_quat ,  upvec ,  ( float ) moffset [ 1 ] * - time_redraw * 20 ) ;  /* Rotate about the relative up vec */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													mul_qt_qtqt ( rv3d - > viewquat ,  rv3d - > viewquat ,  tmp_quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fly - > xlock )  fly - > xlock  =  2 ;  /*check for rotation*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fly - > zlock )  fly - > zlock  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													fly - > xlock_momentum =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* rotate about the Y axis- look left/right */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( moffset [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* if we're upside down invert the moffset */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 0 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 1 ] = 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 2 ] = 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if ( upvec [ 2 ]  <  0.0f ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														moffset [ 0 ] =  - moffset [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* make the lock vectors */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fly - > zlock )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 0 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 1 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 2 ] = 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 0 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 1 ] = 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 2 ] = 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													axis_angle_to_quat (  tmp_quat ,  upvec ,  ( float ) moffset [ 0 ] * time_redraw * 20 ) ;  /* Rotate about the relative up vec */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													mul_qt_qtqt ( rv3d - > viewquat ,  rv3d - > viewquat ,  tmp_quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fly - > xlock )  fly - > xlock  =  2 ; /*check for rotation*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fly - > zlock )  fly - > zlock  =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > zlock = = 2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 0 ] = 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 1 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 2 ] = 0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/*make sure we have some z rolling*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fabs ( upvec [ 2 ] )  >  0.00001f )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														roll =  upvec [ 2 ] * 5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 0 ] = 0 ;  /*rotate the view about this axis*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 1 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 2 ] = 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														axis_angle_to_quat (  tmp_quat ,  upvec ,  roll * time_redraw_clamped * fly - > zlock_momentum * 0.1 ) ;  /* Rotate about the relative up vec */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														mul_qt_qtqt ( rv3d - > viewquat ,  rv3d - > viewquat ,  tmp_quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > zlock_momentum  + =  0.05f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > zlock = 1 ;  /* dont check until the view rotates again */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > zlock_momentum =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( fly - > xlock = = 2  & &  moffset [ 1 ] = = 0 )  {  /*only apply xcorrect when mouse isnt applying x rot*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 0 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 1 ] = 0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													upvec [ 2 ] = 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													/*make sure we have some z rolling*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fabs ( upvec [ 2 ] )  >  0.00001 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														roll =  upvec [ 2 ]  *  - 5 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 0 ] =  1.0f ;  /*rotate the view about this axis*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 1 ] =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														upvec [ 2 ] =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														mul_m3_v3 ( mat ,  upvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														axis_angle_to_quat (  tmp_quat ,  upvec ,  roll * time_redraw_clamped * fly - > xlock_momentum * 0.1f ) ;  /* Rotate about the relative up vec */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														mul_qt_qtqt ( rv3d - > viewquat ,  rv3d - > viewquat ,  tmp_quat ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > xlock_momentum  + =  0.05f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > xlock = 1 ;  /* see above */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														fly - > xlock_momentum =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( apply_rotation )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* Normal operation */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* define dvec, view direction vector */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													dvec_tmp [ 0 ] =  dvec_tmp [ 1 ] =  dvec_tmp [ 2 ] =  0.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* move along the current axis */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													dvec_tmp [ fly - > axis ] =  1.0f ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_m3_v3 ( mat ,  dvec_tmp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mul_v3_fl ( dvec_tmp ,  fly - > speed  *  time_redraw  *  0.25f ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* impose a directional lag */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											interp_v3_v3v3 ( dvec ,  dvec_tmp ,  fly - > dvec_prev ,  ( 1.0f / ( 1.0f + ( time_redraw * 5.0f ) ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 21:20:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												Object  * lock_ob =  fly - > root_parent  ?  fly - > root_parent  :  fly - > v3d - > camera ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( lock_ob - > protectflag  &  OB_LOCK_LOCX )  dvec [ 0 ]  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( lock_ob - > protectflag  &  OB_LOCK_LOCY )  dvec [ 1 ]  =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( lock_ob - > protectflag  &  OB_LOCK_LOCZ )  dvec [ 2 ]  =  0.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											add_v3_v3v3 ( rv3d - > ofs ,  rv3d - > ofs ,  dvec ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* todo, dynamic keys */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								#if 0 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( fly - > zlock  & &  fly - > xlock ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_area_headerprint ( fly - > ar ,  " FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X  on/Z on,   Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  if  ( fly - > zlock ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_area_headerprint ( fly - > ar ,  " FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X off/Z on,   Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else  if  ( fly - > xlock ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_area_headerprint ( fly - > ar ,  " FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X  on/Z off,  Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											else 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 08:47:20 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ED_area_headerprint ( fly - > ar ,  " FlyKeys  Speed:(+/- | Wheel),  Upright Axis:X off/Z off,  Slow:Shift,  Direction:WASDRF,  Ok:LMB,  Pan:MMB,  Cancel:RMB " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( rv3d - > persp = = RV3D_CAMOB )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												ID  * id_key ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* transform the parent or the camera? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if ( fly - > root_parent )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-03-22 09:30:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													Object  * ob_update ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 09:02:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								                    
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													float  view_mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													float  prev_view_imat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													float  diff_mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													float  parent_mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													invert_m4_m4 ( prev_view_imat ,  prev_view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													view3d_persp_mat4 ( rv3d ,  view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													mul_m4_m4m4 ( diff_mat ,  prev_view_imat ,  view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													mul_m4_m4m4 ( parent_mat ,  fly - > root_parent - > obmat ,  diff_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													object_apply_mat4 ( fly - > root_parent ,  parent_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 21:20:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													// where_is_object(scene, fly->root_parent);
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-26 09:02:52 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													ob_update =  v3d - > camera - > parent ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													while ( ob_update )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														DAG_id_flush_update ( & ob_update - > id ,  OB_RECALC_OB ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														ob_update =  ob_update - > parent ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 21:20:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													copy_m4_m4 ( prev_view_mat ,  view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													id_key =  & fly - > root_parent - > id ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 21:20:00 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													float  view_mat [ 4 ] [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													view3d_persp_mat4 ( rv3d ,  view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													object_apply_mat4 ( v3d - > camera ,  view_mat ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													id_key =  & v3d - > camera - > id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												/* record the motion */ 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:40:09 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( autokeyframe_cfra_can_key ( scene ,  id_key ) )  { 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													ListBase  dsources  =  { NULL ,  NULL } ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-05 08:14:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													/* add datasource override for the camera object */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													ANIM_relative_keyingset_add_source ( & dsources ,  id_key ,  NULL ,  NULL ) ;  
							 
						 
					
						
							
								
									
										
										
										
											2010-02-05 08:14:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* insert keyframes 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													 * 	1 )  on  the  first  frame 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													 * 	2 )  on  each  subsequent  frame 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													 * 		TODO :  need  to  check  in  future  that  frame  changed  before  doing  this  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													 */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( fly - > xlock  | |  fly - > zlock  | |  moffset [ 0 ]  | |  moffset [ 1 ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-05 08:14:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														KeyingSet  * ks =  ANIM_builtin_keyingset_get_named ( NULL ,  " Rotation " ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														ANIM_apply_keyingset ( C ,  & dsources ,  NULL ,  ks ,  MODIFYKEY_MODE_INSERT ,  ( float ) CFRA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( fly - > speed )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-05 08:14:33 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														KeyingSet  * ks =  ANIM_builtin_keyingset_get_named ( NULL ,  " Location " ) ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														ANIM_apply_keyingset ( C ,  & dsources ,  NULL ,  ks ,  MODIFYKEY_MODE_INSERT ,  ( float ) CFRA ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* free temp data */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													BLI_freelistN ( & dsources ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/*were not redrawing but we need to update the time else the view will jump */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fly - > time_lastdraw =  PIL_check_seconds_timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* end drawing */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										VECCOPY ( fly - > dvec_prev ,  dvec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* moved to flyEnd() */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_FINISHED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  fly_invoke ( bContext  * C ,  wmOperator  * op ,  wmEvent  * event ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									RegionView3D  * rv3d =  CTX_wm_region_view3d ( C ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FlyInfo  * fly ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( rv3d - > viewlock ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly =  MEM_callocN ( sizeof ( FlyInfo ) ,  " FlyOperation " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									op - > customdata =  fly ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( initFlyInfo ( C ,  fly ,  op ,  event ) = = FALSE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MEM_freeN ( op - > customdata ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									flyEvent ( fly ,  event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									WM_event_add_modal_handler ( C ,  op ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_RUNNING_MODAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  fly_cancel ( bContext  * C ,  wmOperator  * op ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FlyInfo  * fly  =  op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > state  =  FLY_CANCEL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									flyEnd ( C ,  fly ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									op - > customdata =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  OPERATOR_CANCELLED ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  fly_modal ( bContext  * C ,  wmOperator  * op ,  wmEvent  * event ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  exit_code ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FlyInfo  * fly  =  op - > customdata ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fly - > redraw =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									flyEvent ( fly ,  event ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-27 12:43:48 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( event - > type = = TIMER  & &  event - > customdata  = =  fly - > timer ) 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												== Massive Keying Sets Recode ==
After a few days of wrong turns and learning the finer points of RNA-type-subclassing the hard way, this commit finally presents a refactored version of the Keying Sets system (now version 2) based on some requirements from Cessen.
For a more thorough discussion of this commit, see 
http://sites.google.com/site/aligorith/keyingsets_2.pdf?attredirects=0&d=1
------
The main highlight of this refactor is that relative Keying Sets have now been recoded so that Python callbacks are run to generate the Keying Set's list of paths everytime the Keying Set is used (to insert or delete keyframes), allowing complex heuristics to be used to determine whether a property gets keyframed based on the current context. These checks may include checking on selection status of related entities, or transform locks.
Built-In KeyingSets have also been recoded, and moved from C and out into Python. These are now coded as Relative Keying Sets, and can to some extent serve as basis for adding new relative Keying Sets. However, these have mostly been coded in a slightly 'modular' way which may be confusing for those not so familiar with Python in general. A usable template will be added soon for more general usage.
Keyframing settings (i.e. 'visual', 'needed') can now be specified on a per-path basis now, which is especially useful for Absolute Keying Sets, where control over this is often beneficial.
Most of the places where Auto-Keyframing is performed have been tidied up for consistency. I'm sure quite a few issues still exist there, but these I'll clean up over the next few days.
											 
										 
										
											2010-03-16 06:18:49 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										flyApply ( C ,  fly ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-18 00:29:08 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if ( fly - > redraw )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									exit_code  =  flyEnd ( C ,  fly ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( exit_code ! = OPERATOR_RUNNING_MODAL ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ED_region_tag_redraw ( CTX_wm_region ( C ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  exit_code ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  VIEW3D_OT_fly ( wmOperatorType  * ot ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* identifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > name =  " Fly Navigation " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-10 21:15:44 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > description =  " Interactively fly around the scene " ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-23 11:26:16 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ot - > idname =  " VIEW3D_OT_fly " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* api callbacks */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > invoke =  fly_invoke ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > cancel =  fly_cancel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > modal =  fly_modal ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > poll =  ED_operator_view3d_active ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ot - > flag =  OPTYPE_BLOCKING ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-02-14 10:03:24 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								/* ************************************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  view3d_align_axis_to_vector ( View3D  * v3d ,  RegionView3D  * rv3d ,  int  axisidx ,  float  vec [ 3 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  alignaxis [ 3 ]  =  { 0.0 ,  0.0 ,  0.0 } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									float  norm [ 3 ] ,  axis [ 3 ] ,  angle ,  new_quat [ 4 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if ( axisidx  >  0 )  alignaxis [ axisidx - 1 ] =  1.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  alignaxis [ - axisidx - 1 ] =  - 1.0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-25 20:26:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									normalize_v3_v3 ( norm ,  vec ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-11-10 20:43:45 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									angle =  ( float ) acos ( dot_v3v3 ( alignaxis ,  norm ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									cross_v3_v3v3 ( axis ,  alignaxis ,  norm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									axis_angle_to_quat (  new_quat , axis ,  - angle ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									rv3d - > view =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( rv3d - > persp = = RV3D_CAMOB  & &  v3d - > camera )  { 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* switch out of camera view */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										float  orig_ofs [ 3 ] ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  orig_dist =  rv3d - > dist ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										float  orig_lens =  v3d - > lens ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										VECCOPY ( orig_ofs ,  rv3d - > ofs ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rv3d - > persp =  RV3D_PERSP ; 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split, 
press SHIFT+ALT+CTRL+S for four-split. 
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
  convert from older files. Not all settings are copied over
  though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
  for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
											 
										 
										
											2009-01-19 16:54:41 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										rv3d - > dist =  0.0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										view_settings_from_ob ( v3d - > camera ,  rv3d - > ofs ,  NULL ,  NULL ,  & v3d - > lens ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										smooth_view ( NULL ,  NULL ,  NULL ,  orig_ofs ,  new_quat ,  & orig_dist ,  & orig_lens ) ;  // XXX
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-10-27 02:54:25 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( rv3d - > persp = = RV3D_CAMOB )  rv3d - > persp =  RV3D_PERSP ;  /* switch out of camera mode */ 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-26 18:15:46 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										smooth_view ( NULL ,  NULL ,  NULL ,  NULL ,  new_quat ,  NULL ,  NULL ) ;  // XXX
 
							 
						 
					
						
							
								
									
										
										
										
											2008-12-19 12:14:58 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}